Skip to content

Commit

Permalink
bpo-30550: Clarify JSON ordering guarantees (GH-15397) (GH-15403)
Browse files Browse the repository at this point in the history
(cherry picked from commit 657008e)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
  • Loading branch information
miss-islington and rhettinger committed Aug 22, 2019
1 parent 5fda09c commit 4a40498
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ See :ref:`json-commandline` for detailed documentation.
value) is also a subset of YAML 1.0 and 1.1. This module can thus also be
used as a YAML serializer.

.. note::

This module's encoders and decoders preserve input and output order by
default. Order is only lost if the underlying containers are unordered.

Prior to Python 3.7, :class:`dict` was not guaranteed to be ordered, so
inputs and outputs were typically scrambled unless
:class:`collections.OrderedDict` was specifically requested. Starting
with Python 3.7, the regular :class:`dict` became order preserving, so
it is no longer necessary specify :class:`collections.OrderedDict` for
JSON generation and parsing.


Basic Usage
-----------
Expand Down

0 comments on commit 4a40498

Please sign in to comment.