JSON Key Sorter

Sort the keys of every object in a JSON document, A to Z or Z to A, so files diff cleanly and are easy to scan.

Processed on your device. Files are not uploaded

How to sort the keys of a JSON document

  1. Paste your JSON

    Paste or type it into the box, or press Try an example.

  2. Choose the order

    A to Z or Z to A.

  3. Copy or download

    Sorted keys make diffs and version control easier to read.

Worked example

This is what JSON Key Sorter gives for its own sample values. Open the tool above and change anything to try your own.

JSON

{ "version": "1.0.0", "name": "sarva", "scripts": { "test": "vitest", "build": "next build" } }
Order
A to Z
Indentation
2 spaces

Sorted JSON

{
  "name": "sarva",
  "scripts": {
    "build": "next build",
    "test": "vitest"
  },
  "version": "1.0.0"
}

About JSON Key Sorter

Sort the keys of every object in a JSON document, including nested ones. Sorted files give small, readable diffs in version control.

FAQs

Are lists reordered?

No. Only object keys are sorted. List order carries meaning, so it is kept.

Is the sort case-sensitive?

No. It uses a natural alphabetical order.

Can I format it as well?

Pick the indentation, or use JSON Formatter & Validator.

Related tools