Make tojson filter in Jinja2 output Unicode instead of escape sequences

This wasn’t documented anywhere, but kudos to the Jinja2 devs for making this so easy to figure out from the source code.

You need to add a new key to the environment:
env.policies['json.dumps_kwargs'] = {'ensure_ascii': False}

This entry was posted in How to’s and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *