Skip to content
TabKiwiTabKiwi

JSON Sort Keys

Reorder object keys alphabetically at every nesting level, so JSON files diff cleanly.

DeveloperRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

Sorting keys gives two JSON documents with the same data the same layout, which makes diffs and code reviews far easier. Keys are sorted at every depth, including inside objects within arrays, while the order of array items is left alone. Choose A to Z, Z to A or natural order, where item2 comes before item10. Everything runs locally.

How to use JSON Sort Keys

  1. Paste JSON into the left box.
  2. Choose the sort order and whether case matters.
  3. Pick indentation or minified output.
  4. Copy or download the sorted JSON.

Frequently asked questions

Are arrays sorted too?

No. Array order usually carries meaning, so items stay where they are. Only the keys of objects, including objects inside arrays, are reordered.

What does natural order do?

It compares runs of digits as numbers, so key2 sorts before key10 instead of after it.

More Developer tools

View all 91 →