Why Sort JSON Keys?
JSON object keys are unordered by spec, technically {"a":1,"b":2} and {"b":2,"a":1} mean exactly the same thing, but a json key sorter like this one still solves a real, practical problem. Version control diffs on JSON files (config files, API fixtures, translation files) become far noisier than necessary when key order varies between commits just because a script or library happened to emit keys in a different sequence, sorted keys keep diffs focused on values that actually changed. Sorted keys also make manually scanning or comparing two JSON objects side by side dramatically easier, and normalize output from APIs or tools that don't guarantee a consistent key order across calls.
How to Use This JSON Key Sorter
Paste your JSON into the input field, results update automatically as you type. Pick Ascending (A to Z) or Descending (Z to A) for the sort direction, toggle Recursive on to sort nested objects at every depth rather than just the top level, and enable Sort array items if you also want arrays of plain strings or numbers reordered (arrays of objects are always left in their original order, see below). Adjust Indent to control the output's spacing, then copy or download the sorted result.
Recursive vs Top-Level-Only Sorting
This recursive json key sorter distinction matters most on deeply nested JSON, a config file with sections and subsections, or an API response with nested resource objects. With Recursive off, only the outermost object's keys get reordered, everything nested inside stays exactly as it was. With Recursive on, this tool can sort nested json keys at every depth independently, giving you a fully normalized structure top to bottom in one pass instead of needing to sort each nested level separately.
| Mode | What Gets Sorted | Use Case |
|---|---|---|
| Top-level only (Recursive off) | Only the outermost object's keys | You only care about the top-level structure, nested objects are already in a meaningful order |
| Recursive (Recursive on) | Every object at every nesting depth | Fully normalizing a deeply nested config, fixture, or API response |
What This Tool Does and Doesn't Sort
This json array sorter sorts object keys always, and optionally sorts array items, but only arrays where every element is a plain string or number, mixed or all-string/number arrays included. Arrays of objects are always left in their original order regardless of the Sort array items setting, reordering objects within an array usually changes something meaningful (list order, precedence, sequence), unlike object keys which are order-independent by spec, so this tool doesn't attempt to guess a "correct" order for them. Values themselves are never modified, only key order (and, optionally, homogeneous array item order) changes, every value in your JSON survives the sort completely unchanged.