Logo JSON Parser Online

Sort JSON Keys Alphabetically Online

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.

All JSON Tools

28 tools

Free, fast, runs in your browser. No login needed.

Made with ❤️ in India · © 2025 parsejsononline.com
INPUT
1
OUTPUT
1
✅ Ready
Characters: 0
Ctrl+Enter to run
What is this tool?

How to use

  1. Paste your JSON into the INPUT pane.
  2. Select sort direction: A to Z or Z to A.
  3. Click Sort Keys.
  4. The output has all object keys sorted at every nesting level.

How it works

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:

  • Diffing — two JSON documents with the same data but different key order produce noisy diffs. Sort both sides first to produce a clean diff of actual value changes.
  • Canonical form — when storing JSON in version control, sorted keys reduce spurious changes across edits.
  • Readability — alphabetical order makes large objects easier to scan when you know the key you're looking 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.

FAQ

Does it sort recursively through nested objects?

Yes. Every object at every nesting level has its keys sorted — including objects inside arrays, and objects nested arbitrarily deep.

Are array elements reordered?

No. Array element order is preserved. Only the keys within JSON objects are sorted.

Does sorting change the data?

No. Sorting only reorders keys within objects. The values are identical. The output is semantically equivalent to the input.

Can I sort in descending order?

Yes. Select "Z to A" from the dropdown before clicking Sort Keys.

Is my data sent anywhere?

No. Sorting runs entirely in your browser.

Related tools

JSON DiffCompare two JSON documents after sorting to normalize key order. JSON FormatterFormat JSON with indentation after sorting. Flatten JSONFlatten nested objects into a single-level structure.