🔒 Runs in your browser — nothing is uploaded✓ Free, no signup

JSON Sorter — Sort Keys Alphabetically

Sort the keys of a JSON object alphabetically — including every nested object — to make JSON easier to read, compare and keep tidy.

Loading...

0 characters

Sorted JSON

Loading...

When should you use the JSON Sorter?

  • Making two JSON files easier to compare by putting keys in the same order
  • Tidying config files and translation (i18n) files
  • Producing stable, predictable JSON for diffs and code review

How to use the JSON Sorter

  1. 1

    Paste JSON

    Paste an object or array into the left editor.

  2. 2

    Choose the order

    A → Z or Z → A. Natural order puts item2 before item10.

  3. 3

    Pick what to sort

    Nested objects are sorted by default. Tick 'Also sort arrays of values' to sort lists of strings or numbers too.

  4. 4

    Copy or download

    Copy the sorted JSON or download it.

Examples

Nested keys sorted A → Z

Before

{ "zebra": 1, "apple": { "z": true, "b": 2 } }

After

{
  "apple": {
    "b": 2,
    "z": true
  },
  "zebra": 1
}

Common errors and how to fix them

Numeric keys come first
JavaScript always puts integer-like keys such as "1" and "2" before other keys, in numeric order. This is how JSON objects work in browsers.
Array items didn't move
Arrays are kept in order by default because order often matters. Tick 'Also sort arrays of values' to sort them.
Related tools: JSON Compare · JSON Formatter · JSON Editor

More from JSON Tools

Free tools that run in your browser — no signup, nothing uploaded.

JSON Sorter FAQ

No. Only the order of keys changes — values stay the same, and JSON objects are unordered by definition, so the data is equivalent.

Yes, by default every object at every level is sorted. Untick 'Sort nested objects' to sort only the top level.

It compares numbers inside keys by value, so item2 comes before item10. Plain alphabetical order would put item10 first.

Sorted keys make files easier to scan and make diffs cleaner, because the same keys always appear in the same place.

Not yet — it sorts keys and, optionally, arrays of plain strings or numbers.

No. Everything runs in your browser, so your JSON never leaves your device.