This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lebigot
Recipients lebigot
Date 2017-06-02.09:47:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The JSON encoder for dictionaries preserves the order of the items in a dictionary: it would be useful to document this behavior, so that users can rely on it.

While JSON itself does not have ordered key/value pairs, this feature can be useful (for modifying the original JSON document while maintaining as much of it untouched, for manipulating our own extension of JSON with ordered dictionaries, etc.).

The documentation could also usefully mention that _reading_ sets of key/value pairs can also be done in an order-preserving way with `object_pairs_hook=OrderedDict`.

Reference: the json module does not alter the order of the dictionary items upon encoding:
Date User Action Args
2017-06-02 09:47:27lebigotsetrecipients: + lebigot
2017-06-02 09:47:27lebigotsetmessageid: <>
2017-06-02 09:47:27lebigotlinkissue30550 messages
2017-06-02 09:47:26lebigotcreate