R. David Murray added the comment: Yes but the input is turned into a dict, and dicts do not preserve order. Further, what is passed to the object_hook is already a dict, so the order is already lost before object_hook is called.
Since the parser (or at least the Python version of the parser) first turns the input into a list of pairs, and a Python OrderedDict can be instantiated from a list of pairs, it would theoretically be possible to extend the object_hook API to allow an OrderedDict to be used on decode. Exactly how to do that so as to retain backward compatibility is a bit of a question. So, it is *possible* to achieve your aim, but it isn't as simple as allowing sort= to be set False. IMO being able to preserve the order of the input when desired (ie: use an OrderedDict object_hook) would be a nice feature to have. ---------- stage: patch review -> needs patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21650> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com