Skip to content

gh-135623: Document that json sorts the keys before coercing them to strings - #156987

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:json-sort-keys-docs
Open

gh-135623: Document that json sorts the keys before coercing them to strings#156987
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:json-sort-keys-docs

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

sort_keys sorts the keys of a dictionary, not the strings written to the output, so numeric keys are sorted by value. This is not obvious, because the keys are coerced to strings, and re-dumping the loaded result gives a different order.

…em to strings

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Sep 5, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Sep 5, 2026
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Sep 5, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34408362 | 📁 Comparing b8bc136 against main (e620377)

  🔍 Preview build  

1 file changed
± library/json.html

@terryjreedy

Copy link
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants