I spent couple of hours yesterday trying to understand why tojson output had a different order from json.dumps order.
The thing is that Flask sets sort_keys to True by default (see https://github.com/mitsuhiko/flask/blob/master/flask/json.py#L102). Is it possible to add something regarding this, and the JSON_SORT_KEYS in the doc ?
http://flask.pocoo.org/docs/api/#flask.Flask.default_config does mention how JSON_SORT_KEYS is set to a default of True.
Would it be helpful to add something in the API documentation here: http://flask.pocoo.org/docs/api/#module-flask.json?
Ok, it's written in the default's config dict, but there is no explanation, nowhere, of this behaviour or this setting.
It's not that straightforward for a template filter to re-order outputs by default, well, at least it wasn't for me :)
added a note to the api documentation about JSON_SORT_KEYS. Fixes #922
The docs mention that now. Keep in mind though that "flask.json" has the same behavior and you should be using this module instead of the stdlib one.