JSON Key Sorter

Sort the keys of a JSON object A to Z, Z to A or in natural order, at every level or only the top. Good before comparing two files.

How it works

Puts the keys of every JSON object in order, at every level or only the top one. Choose A to Z, Z to A, natural order or plain character-code order. It tells you how many objects actually changed.

  1. Paste your JSON.
  2. Pick an order and whether to go deep.
  3. Copy the sorted result.

Worked example

{"b":1,"a":2} becomes {"a":2,"b":1}. With natural order, "item2" comes before "item10". With character-code order, "Zebra" comes before "apple" because capitals sort first.

Good to know

Common questions

Why do number keys stay at the front?
JavaScript always stores keys that are whole numbers first, in number order. No tool that runs on JavaScript objects can change that. The note appears when your JSON has such keys.
Does sorting change what the JSON means?
No. JSON objects are unordered, so the data is the same. Only the text layout changes.
What is the difference between A to Z and character-code order?
A to Z follows language rules, so "apple" comes before "Zebra". Character code puts every capital letter before every small letter.
Is my JSON uploaded?
No. It is sorted in your browser.

More in Data.