Sort JSON Keys
Normalise JSON by sorting all keys alphabetically at every nesting level. Makes diffs cleaner and output predictable.
FORMAT
Tips
Paste JSON in the left pane. Output updates instantly.
How it works
After JSON.parse turns your input into an in-memory tree, the tool walks every object and rebuilds it with keys in alphabetical order, recursing into nested objects and through array elements. JSON.stringify(sortedValue, null, 2) then emits the normalised tree with two-space indentation. The stable key order makes diffs between two JSON files line up cleanly so real changes stand out.
Processing runs in your browser
All processing happens inside your browser tab. Our servers are not involved at any point.
Related operations
For converting between data formats, try CSV to JSON or the YAML formatter. To decode tokens, use the JWT decoder. For escaping URL data, try URL encode.
Frequently asked questions
- Why sort JSON keys?
- Sorted keys make it easier to diff two JSON files and to find specific fields quickly.
- Does it sort nested objects too?
- Yes. Keys are sorted recursively through every level of the object.
- Does the order of array items change?
- No, only object keys are sorted. Array order is preserved.