JSON Sorter
This JSON sorter reorders the keys of every object in a document alphabetically, at every level of nesting, without touching any value — so the sorted output parses to exactly the same data. Sorting gives you a canonical form, which means two payloads holding identical data stop producing noisy diffs just because their serializers emitted keys in a different order. You can sort A to Z or Z to A, ignore case, and optionally alphabetise arrays of plain values; arrays containing objects keep their original order, because position usually carries meaning in a list.
How it works
Every object in the document gets its keys reordered alphabetically, at every level of nesting — useful for making two config files diff cleanly, or for finding a key in a large payload. Values are never touched, so the sorted output parses to exactly the same data.
Arrays keep their original order by default, because position usually carries meaning in a list. Turn on Sort arrays too to alphabetise arrays of plain values; arrays containing objects stay in place either way.
How to sort JSON keys alphabetically
- Paste your JSON into the input on the left.
- Pick A → Z or Z → A, and choose whether to ignore case.
- Turn on Sort arrays too if you also want arrays of plain values alphabetised.
- Copy or download the sorted result on the right.
Why sorting keys helps
Two JSON documents can hold identical data and still produce a messy diff, because most serializers emit keys in insertion order rather than a stable one. Sorting both files first gives you a canonical form, so a diff shows only the values that genuinely changed. It also makes a long config file far easier to scan when you are hunting for a specific key.
Common use cases
- Canonicalising two payloads before comparing them.
- Tidying a package manifest, translation file or feature-flag config.
- Making a large settings object easier to read and review.
Frequently asked questions
How do I sort JSON keys alphabetically?
Paste your document into the input and the sorted result appears immediately. Every object is sorted at every level of nesting, so you do not need to handle nested structures separately.
Does sorting change my data?
No. Only the order in which keys are written changes. Values, types and structure are untouched, so the sorted output parses to exactly the same data as the original.
Why are arrays not sorted by default?
Position usually carries meaning in an array — a list of steps, a ranking, a sequence of events — so reordering it would change what the document says. Enable the array option only when you know the order is arbitrary.
What happens to arrays of objects when array sorting is on?
They keep their original order. Only arrays whose items are all plain values — strings, numbers, booleans or nulls — are alphabetised, because there is no unambiguous way to rank objects.
Why would I want sorted JSON?
Sorting produces a canonical form, so two files with the same data compare cleanly instead of showing dozens of moved lines. It also makes a long config or translation file far easier to scan when you are looking for one specific key.
Is my JSON uploaded when I sort it?
No. Sorting runs entirely in your browser, so nothing you paste is transmitted or stored anywhere.
Related tools
JSON Formatter & Beautifier
This JSON formatter beautifies minified or messy JSON online with clean indentation, line numbers, and code folding.
JSON Compare & Diff
This JSON compare tool diffs two documents by structure, ignoring key order and formatting.
JSON Minifier
This JSON minifier strips whitespace and line breaks to shrink payload size for APIs and config files.