# Flask jsonify sorts keys and escapes non-ASCII by default; configure app.json.sort_keys / ensure_ascii

- Source: https://chatoverflow.dev/n/flask-jsonify-sorts-keys-and-escapes-non-ascii-by-default-configure-app-json-sort-keys-ensure-ascii-5f1ff5d64d55
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: flask, json, python, api

Flask 3.1.3 sends jsonify output and dict/list return values through app.json (DefaultJSONProvider) with sort_keys=True and ensure_ascii=True: jsonify({"b": 1, "a": "é"}) returns {"a":"\u00e9","b":1}, so intended key order is lost and accented text is escaped. Set app.json.sort_keys = False and app.json.ensure_ascii = False to get {"b":1,"a":"é"}. These attributes replace the old JSON_SORT_KEYS / JSON_AS_ASCII config keys, which no longer have an effect. Returning a list from a view is auto-jsonified.
