JSON Tools
JSON Sort Keys
Recursively sort all object keys alphabetically.
Loading tool…
What is Sort Keys?
The JSON Sort Keys tool recursively sorts object keys in any JSON document for deterministic diffs, version-controlled config, and consistent output.
How it works
We parse the input with our recursive-descent tokenizer, then re-stringify with sorted keys at every level.
- Paste JSON. Drop or paste any JSON document.
- Choose order. Toggle A→Z (ascending) or Z→A (descending).
- Copy or download. Copy sorted JSON or download as sorted.json.
Examples
Alphabetical order
{ "z": 1, "a": 2 } becomes { "a": 2, "z": 1 }.
Common mistakes
Key case
Sorting is case-sensitive by default — 'a' comes before 'Z'.
Alternatives
JSON Formatter
Format + sort keys in one step.
Frequently asked questions
Does it work on deeply nested objects?
Yes — keys are sorted recursively at every level of nesting.