How to use JSON Sorter
- Paste the JSON whose keys you want to normalise.
- Pick A → Z or Z → A and the indentation style.
- Copy the canonical result into your config, fixture or snapshot.
JSON Sorter features
- Recursively sorts object keys ascending or descending
- Keeps array order untouched
- Locale-aware, case-insensitive ordering
- Choose indentation for the output, including minified
- Live output with copy and download
JSON Sorter example
Canonicalise a fixture
Input:
{"zeta":1,"alpha":{"y":true,"x":false}}Output:
{
"alpha": {
"x": false,
"y": true
},
"zeta": 1
}Frequently asked questions about JSON Sorter
Are nested objects sorted too?
Yes. Keys are sorted recursively at every level, including objects inside arrays.
Does sorting change arrays?
No. Array order carries meaning, so items keep their positions; only object keys are reordered.
Why sort keys at all?
Sorted keys give a canonical representation. Two documents with the same content become byte-identical, which is ideal for snapshot tests, cache keys, config files and clean git diffs.
How is the order decided?
Keys are compared with locale-aware, case-insensitive ordering (A → Z or Z → A), so "Beta" sorts between "alpha" and "gamma".