Paste JSON and click Sort Keys. All object keys are sorted alphabetically — including keys in nested objects. Choose ascending (A to Z) or descending (Z to A) order. Useful for normalizing JSON before diffing, enforcing key order in config files, or making large objects easier to scan.
Free, fast, runs in your browser. No login needed.
The sorter walks your JSON recursively. At each object it encounters — regardless of nesting depth — it collects the keys, sorts them alphabetically, and rebuilds the object in sorted order. Array element order is preserved; only the keys within objects are reordered.
Why sort JSON keys? JSON objects are technically unordered, but key order is preserved in practice by all modern JavaScript engines and most other language implementations. Sorting keys is useful for:
Arrays are not sorted. Only object keys are reordered. If you have an array of objects, the array order is preserved — only the keys within each object are sorted.
Yes. Every object at every nesting level has its keys sorted — including objects inside arrays, and objects nested arbitrarily deep.
No. Array element order is preserved. Only the keys within JSON objects are sorted.
No. Sorting only reorders keys within objects. The values are identical. The output is semantically equivalent to the input.
Yes. Select "Z to A" from the dropdown before clicking Sort Keys.
No. Sorting runs entirely in your browser.