JSON Key Sorter
Sort every object's keys alphabetically throughout a JSON document, recursively — makes diffs clean and configs easy to scan.
566 views
Alphabetise Every Key, Recursively
Paste JSON and get it back with every object's keys sorted alphabetically — nested objects and arrays included, arrays keep their original order (only key order changes). Sorted, indented JSON is far easier to scan by eye and produces much cleaner diffs when comparing two versions in version control.
Handy for normalising config files, comparing two API responses that differ only in key order, or making a hand-written JSON file more readable.
Frequently Asked Questions
Does this change the data, only the order?
Only key order changes — values, nesting and array contents are untouched. JSON objects are unordered by the spec, so this is always a safe, non-breaking transformation.
What if my JSON is invalid?
You get a clear parse error instead of silent failure — fix the syntax issue it points to and try again.
Does it sort arrays too?
No — array element order is preserved exactly, since arrays are ordered by definition and reordering them would change meaning. Only object keys are alphabetised.
Similar Tools
Report a Problem
JSON Key Sorter