Sort JSON Keys

Sort every object key A to Z (nested too).

Also called: JSON key sorter.

FreeNo sign-upRuns in your browser
DEVELOPER

Sort JSON Keys

Sort every object key A to Z (nested too).

Runs locally in your browser
Ready. Fill in the fields above, then press Run tool.
Privacy note: this tool runs in your browser, so the text you enter stays on your device.

Find a tool

Loading tools…

Watch: how to use the Sort JSON Keys (12 seconds)

Recorded on a phone, steps written on screen, no sound.

About the Sort JSON Keys

Sort every object key A to Z, including nested objects, so two JSON files are easy to compare and diffs stay clean. Arrays keep their order.

How sorting works

Keys are put in order at every level, including objects inside lists; the order of list items is not changed. Sorting follows character codes, so capital letters come before small letters: B comes before a.

Sorted keys make two JSON files easy to compare line by line and keep settings files tidy in Git. The values are not changed, and the result is indented with two spaces.

How to use the Sort JSON Keys

  1. Enter your textType or paste JSON.
  2. Press Run toolThe result appears right under the button.
  3. Copy or download the resultCopy text results with Copy output; when the tool makes a picture or file, use its Download button.

This tool works inside your browser: what you enter stays on your device.

Example

A sample input and the result the Sort JSON Keys gives for it (produced by the tool itself, not typed by hand).

JSON
{"name": "Kitwise", "tools": 3, "tags": ["pdf", "image", "text"], "free": true}

Result:

{
  "free": true,
  "name": "Kitwise",
  "tags": [
    "pdf",
    "image",
    "text"
  ],
  "tools": 3
}

Good to know

What you need
You type or choose: JSON
Where it runs
In your browser, on your device.
Cost
Free, no sign-up.

Questions

Does it change values?

No, only the key order.

How do I compare two JSON files?

Sort both, then use Text Compare.

More tools in Developer

See all Developer tools