Category: Developer tools

JSON Key Sorter

System ideaMissing a tool?

Recursively sort JSON object keys alphabetically

Sort the keys of every object in a JSON document alphabetically, ascending or descending, with a case-sensitive option and a choice of pretty or compact output. Array element order is preserved by default. Runs entirely in your browser.

Output
{
  "address": {
    "city": "London",
    "country": "UK"
  },
  "name": "Ada Lovelace",
  "role": "Engineer",
  "skills": [
    "Analysis",
    "Mathematics"
  ]
}

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

A JSON document copied from different tools or written by hand often has its keys in an inconsistent order, which makes two otherwise-identical objects look different in a diff. This tool walks the parsed document and rebuilds every object with its keys sorted, leaving array element order untouched by default since sorting a list of records has no natural key order; arrays of plain values can optionally be sorted too.

How to use it

  1. Paste your JSON, or load the example.
  2. Choose ascending or descending order, and whether the comparison should be case-sensitive.
  3. Switch between pretty and compact output, then copy the sorted JSON.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Parsing and sorting happen in JavaScript running in the page, so your JSON never leaves your device.
Does sorting change array order?
Object keys inside array items are still sorted, but the array's own element order is left alone unless you turn off Preserve array order, in which case arrays of plain values (not objects) are sorted too.
What does case-sensitive change?
With it on, uppercase letters sort strictly before lowercase ones; with it off, keys compare the way a dictionary would, ignoring case.