JSON Key Sorter

Recursively sort JSON object keys alphabetically for cleaner, diff-friendly output. Runs entirely in your browser.

About this tool

Recursively sorts every object's keys alphabetically, at every nesting depth. Array order is left untouched — only object key order changes. Useful for producing consistent, diff-friendly JSON before committing it to version control.

Share on LinkedInShare on X
Link to this tool

Copy this HTML to cite this tool from your own site or article.

About JSON Key Sorter

JSON Key Sorter sorts JSON object keys alphabetically at all nesting levels to produce clean, canonical, diff-friendly JSON documents.

How to use JSON Key Sorter

  1. Paste unsorted JSON object payload into the editor.
  2. Select sort order (alphabetical ascending or descending).
  3. Click Sort Keys to recursively reorder object keys.
  4. Copy normalized JSON document.

Examples

Input: {"z":1, "a":2} Sorted Output: { "a": 2, "z": 1 }

FAQ

Does sorting keys change array element ordering?

No. Array element order is preserved exactly as defined; only object keys are sorted.

Does sorting work recursively on nested sub-objects?

Yes. Object keys at every level of nesting are sorted alphabetically.