Json Sorter
Free online json sorter tool, no installation required
About JSON Sorter
Recursively sort every object's keys in a JSON document in ascending or descending locale-aware order. Arrays are preserved in their original order, but each element is still sorted recursively if it is an object. Output is pretty-printed with 2-space indentation.
How to Use
1. Paste JSON into the input textarea. 2. Choose Ascending or Descending sort order. 3. Click Sort. 4. Use Copy to copy the sorted JSON.
Sorting Behavior and Errors
Key comparison uses String.localeCompare on the key names, applied at every nesting level. The root value must be an object or array; a primitive root produces an "error not object" message. Invalid JSON produces an "error invalid JSON" message. Arrays keep their element order, but object elements inside the array have their keys sorted. Numbers, booleans, strings, and null leaves are returned unchanged.
▶Are array elements reordered?
▶What comparison is used for keys?
▶Can the root be a primitive like a string or number?
▶How is the output formatted?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee