Skip to content

JSON Sorter

Sort JSON object keys alphabetically at every level, or sort arrays by a field.

Quick Tool Overview

The JSON Sorter orders object keys alphabetically at every nesting level, using a natural comparison so item2 comes before item10. Arrays of objects can also be sorted by any field you name.

What it does
Sorts JSON object keys and, optionally, arrays of objects
You give it
Any JSON document
You get back
The same data with keys in a predictable order
Best for
Making two payloads comparable before a diff or a checksum
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON Sorter

Two JSON documents that hold the same data can look completely different if the keys come back in a different order. Sorting them both makes the pair comparable by eye, by a text diff and by a checksum — which is the usual reason to do it.

Keys are sorted at every level, with a natural comparison so item2 comes before item10 rather than after it. Arrays of objects can be sorted separately by any field you name, ascending or descending, which is how you make a list of records line up between two environments. Sorting never changes a value: only the order keys appear in, which JSON itself treats as insignificant.

Key features of the JSON Sorter

Sorted at every level

Nested objects are sorted too, not just the top one, so the whole document reaches a canonical order.

Natural number ordering

Digit runs are compared as numbers, so item2 sorts before item10 rather than after it.

Sort arrays by a field

Name a field such as id or name to order arrays of records, ascending or descending.

Values are never touched

Only the order keys appear in changes, which JSON itself treats as insignificant. The data is byte-for-byte the same.

Makes diffs readable

Sort two responses the same way and a plain text diff will show only the real differences.

How to use the JSON Sorter

  1. 1

    Paste the JSON

    Any document — the sorter walks every level of it.

  2. 2

    Choose a direction

    A to Z or Z to A for object keys, applied at every depth.

  3. 3

    Sort arrays by a field

    Name a field such as id or name to order arrays of objects by it as well.

  4. 4

    Copy the result

    Take the sorted document to your clipboard or download it.

Frequently asked questions

The specification says an object is unordered, so no parser should depend on it. It matters to humans and to tools that compare text, which is exactly why sorting is useful.

Reviews of the JSON Sorter

What people who use the JSON Sorter think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON Sorter. It takes half a minute and no account.

Write the first review

More developer tools