JSON Sorter
Paste JSON and sort all object keys alphabetically in one click. Choose ascending or descending order, deep or shallow sort, and optionally sort arrays.
Last updated: May 20, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON Sorter?
Consistent key ordering in JSON makes files easier to read, compare, and diff in version control. When multiple developers edit JSON configuration files, API mock data, or translation files, unsorted keys create noisy diffs that hide real changes. Sorted JSON also makes it easier to find a specific key in a large object without scanning randomly.
This tool recursively sorts all keys in a JSON object (or array of objects) in alphabetical order. Deep mode sorts keys at every nesting level; shallow mode sorts only the top-level keys. You can sort descending instead of ascending, and optionally sort primitive values inside arrays.
How to Use JSON Sorter
Paste JSON into the input area or click "Load Sample"
Choose sort order: Ascending (A→Z) or Descending (Z→A)
Choose depth: Deep (all levels) or Shallow (top level only)
Optionally enable "Sort Arrays" to sort primitive array elements
Copy or download the sorted JSON output
Common Use Cases
- Developers normalising JSON config files before committing to version control to produce clean diffs.
- Teams sorting i18n translation JSON files so keys are consistently ordered across language files.
- API developers sorting JSON mock data files for readability and easier manual editing.
- QA engineers comparing two JSON responses by sorting both before a diff to isolate real differences from key-order noise.
- Data engineers sorting JSON schema files to maintain alphabetical property order across updates.
- Developers cleaning up auto-generated JSON (from ORM tools or code generators) for consistent key ordering.
Example Input and Output
A JSON config object with unsorted keys is sorted alphabetically so it reads predictably and diffs cleanly.
{
"timeout": 30,
"host": "localhost",
"debug": true,
"port": 8080,
"database": {
"pool": 10,
"name": "mydb",
"host": "db.example.com"
}
}{
"database": {
"host": "db.example.com",
"name": "mydb",
"pool": 10
},
"debug": true,
"host": "localhost",
"port": 8080,
"timeout": 30
}Privacy
All sorting runs in your browser. No data is uploaded to any server.
Key ordering in JavaScript
Modern JavaScript engines (V8, SpiderMonkey) preserve insertion order for string keys. JSON.stringify outputs keys in insertion order, so sorting the object before serialising guarantees a consistently ordered output.

