[issue21650] add json.tool option to avoid alphabetic sort of fields

R. David Murray report at bugs.python.org
Fri Jun 6 18:46:49 CEST 2014


R. David Murray added the comment:

Wait, I read the code wrong.

You can define object_pairs_hook, and use that to return an OrderedDict.  So it should be possible to do this without changing the json module itself.  This is actually documented as a place to use OrderedDict.  Guess I should have read the docs instead of the code :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21650>
_______________________________________


More information about the Python-bugs-list mailing list