JSON Key Sorter
Sort JSON object keys alphabetically and pretty-print the result. Useful for code review, cleaner diffs, and stable cache keys — array element order is preserved.
How to Use
Paste JSON text into the left pane or type it. Output updates as you type.
Enable 'Deep sort' to recurse into nested objects. Choose ascending or descending and an indent of 2 spaces, 4 spaces, or tab.
Click Copy for clipboard, or 'Download .json' to save as a file.
FAQ
Are objects inside arrays sorted?
With 'Deep sort' enabled, keys of objects nested inside arrays get sorted, but the *order of array elements themselves* is preserved — array order is usually meaningful.
How is case handled?
This tool uses case-sensitive localeCompare. By default uppercase comes before lowercase (e.g., "Apple" < "apple"), which is the most common JSON convention.
What about Korean / Japanese keys?
They sort by Unicode order, producing natural dictionary-like ordering. Korean, Japanese, and Chinese keys all work.
Why sort JSON keys?
To eliminate diff noise caused only by key order, to stabilize cache keys, and to make code reviews easier on the eye.
Is anything sent to a server?
No. Sorting runs entirely in your browser; your JSON never leaves the page.