jsonecho

JSON Sorter

Sort every key in your JSON alphabetically, at every level, so two versions can be compared line by line.

Loading the tool...

How to use JSON Sorter

  1. Paste your JSON.
  2. Choose ascending or descending order.
  3. Copy the sorted result, or download it.

About JSON Sorter

Key order has no meaning in JSON, but it has a lot of meaning to your version control system. If two people add keys in different places, a diff gets noisy. Sorting the keys before you commit gives every file the same order and makes changes show up where they belong.

Sorting is applied to all nested objects. The order of items inside arrays is not touched, because for arrays the order carries meaning.

Frequently asked questions

Does it sort array items too?

No. Arrays are lists where position matters, so their items stay where they are. Only object keys are sorted.

How are keys with numbers sorted?

In natural order, so "item2" comes before "item10". Upper and lower case are treated alike.

Can sorting break my application?

Almost never, since JSON readers are not supposed to depend on key order. A few signature schemes that hash the exact text are the exception, so do not sort a document you have already signed.

Will it also format the output?

Yes, the sorted JSON is indented using the size you choose.

More in JSON Tools

All tools →