[issue5381] json need object_pairs_hook

Raymond Hettinger report at bugs.python.org
Thu Mar 5 00:39:58 CET 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

After enhancing namedtuple and ConfigParser, I found a simpler approach
that doesn't involve extending the API.  The simple way is to use
ordered dictionaries directly.  

With a small tweak to OD's repr, it is fully substitutable for a dict
without changing any client code or doctests (the OD loses its own
eval/repr order-preserving roundtrip but what json already gives now).

See attached patch.

Added file: http://bugs.python.org/file13244/json_ordered.diff

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


More information about the Python-bugs-list mailing list