https://github.com/python/cpython/commit/64740410909891331eb4e4cbdb14837ff4f8ec64 commit: 64740410909891331eb4e4cbdb14837ff4f8ec64 branch: main author: Serhiy Storchaka <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-09-13T11:04:50+03:00 summary:
gh-135623: Document that json sorts the keys before coercing them to strings (GH-156987) Co-authored-by: Claude Opus 5 (1M context) <[email protected]> files: M Doc/library/json.rst diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 5e8c452a5ab9a1f..ddd12a002f74163 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -261,6 +261,8 @@ Basic Usage 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, \ _______________________________________________ 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]
