JSON Sort Keys
Alphabetically sort the keys of a JSON object, recursively and deeply.
Two JSON files with identical data but differently-ordered keys produce noisy diffs, break snapshot tests, and hide real changes in a sea of reordered lines. Sorting keys into a canonical order makes JSON deterministic — the same data always serializes the same way.
This tool recursively sorts every object's keys alphabetically, at every level of nesting, while leaving array order untouched (arrays are ordered data, objects aren't). Paste JSON, get a key-sorted, pretty-printed version that's stable across regenerations and clean to diff.
How to use JSON Sort Keys
- 1
Paste your JSON
Any valid JSON object or array.
- 2
Get sorted output
Keys ordered alphabetically at every nesting level.
- 3
Copy the result
Deterministic JSON, ready to commit or compare.
Features
- Recursive, deep key sorting
- Array order preserved (only object keys sort)
- Pretty-printed, diff-friendly output
Frequently asked questions
Common mistakes to avoid
- Expecting array elements to sort — arrays keep their order because position often carries meaning.
- Assuming sorted JSON is a canonical form for signing — true canonicalization (JCS) also normalizes numbers and whitespace.
Get new tools in your inbox
One email a month with new tools, guides, and updates. No spam, unsubscribe anytime.

