https://github.com/python/cpython/commit/4cdf2e454d4f97c1e8b3d4698ff7f8e02f2c7f03
commit: 4cdf2e454d4f97c1e8b3d4698ff7f8e02f2c7f03
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-09-21T15:57:17+03:00
summary:

[3.15] gh-157571: Move json sort note from dumps to dump (GH-157577) (#157897)

Co-authored-by: Gaurav Yadav <[email protected]>
Co-authored-by: Ned Batchelder <[email protected]>
Signed-off-by: MeGaurav4 <[email protected]>

files:
M Doc/library/json.rst

diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index ddd12a002f7416..0d115c5623fd7d 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -234,6 +234,16 @@ Basic Usage
       If ``True``, dictionaries will be outputted sorted by key.
       Default ``False``.
 
+   .. note::
+
+      Keys in key/value pairs of JSON are always of the type :class:`str`. When
+      a dictionary is converted into JSON, all the keys of the dictionary are
+      converted to strings. As a result of this, if a dictionary is converted
+      into JSON and then back into a dictionary, the dictionary may not equal
+      the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
+      keys. *sort_keys* sorts the keys before they are converted to strings,
+      so numeric keys are sorted by value, not by their string representation.
+
    .. versionchanged:: 3.2
       Allow strings for *indent* in addition to integers.
 
@@ -253,17 +263,6 @@ Basic Usage
    table <py-to-json-table>`.  The arguments have the same meaning as in
    :func:`dump`.
 
-   .. note::
-
-      Keys in key/value pairs of JSON are always of the type :class:`str`. When
-      a dictionary is converted into JSON, all the keys of the dictionary are
-      coerced to strings. As a result of this, if a dictionary is converted
-      into JSON and then back into a dictionary, the dictionary may not equal
-      the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
-      keys.
-      *sort_keys* sorts the keys before they are coerced to strings,
-      so numeric keys are sorted by value, not by their string representation.
-
 .. function:: load(fp, *, cls=None, object_hook=None, parse_float=None, \
                    parse_int=None, parse_constant=None, \
                    object_pairs_hook=None, array_hook=None, **kw)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to