JSON Key Sorter
Sort object keys alphabetically — recursively for stable, readable JSON.
- 100% client-side · your data never leaves your browser
- Instant, no rate limits
- Free, no sign-up
Your result appears here
Paste JSON into the panel on the left — everything runs privately in your browser.
Overview
JSON Key Sorter — Alphabetize Object Keys
Sort JSON object keys alphabetically for stable diffs, readable configs, and canonical serialization. Optionally sort recursively so every nested object is ordered consistently. Arrays keep element order; only object keys are reordered. Client-side — safe for secrets and production configs.
Why sort JSON keys?
JSON objects are unordered, but two documents with the same data can look different when keys are in random order. Sorting keys makes text diffs meaningful, reduces merge noise in version control, and helps when comparing hashed or signed payloads that depend on canonical form.
Recursive sorting
With recursive mode enabled, every nested object at every level is sorted alphabetically. Without it, only the top-level object's keys are ordered. In both modes your values and array element order are preserved exactly — only object key order changes.
Stable diffs and clean version control
Because JSON objects are unordered, the same data serialized twice can produce different key orders and a noisy git diff full of moved lines. Sorting keys before committing config, fixtures, or API snapshots gives a canonical order, so diffs show only real changes and merge conflicts shrink.
Canonical form for hashing and signing
Signatures, checksums, and cache keys computed over JSON depend on the exact byte sequence. Two payloads with identical data but different key order hash differently. Sorting keys is a simple way to produce a consistent, canonical representation before hashing or comparing signed payloads.
FAQ
Frequently asked questions
How do I sort JSON keys alphabetically?
Paste your JSON and JsonDrift returns it with object keys ordered A→Z; enable recursive mode to sort every nested object too.
Does sorting change my data?
No. Only object key order changes — values and array element order are preserved.
Does sorting validate JSON?
Input must be valid JSON; invalid input shows a parse error so you can fix it first.
Does this minify the output?
Output is pretty-printed with 2-space indentation. Use the JSON Minifier for compact form.
Continue with a related tool
All tools- JSON Pick & Omit Keys
Select or remove top-level keys from a JSON object — whitelist or blacklist fields.
- JSON Editor
Write, edit, format, minify, and validate JSON in a fast full-screen or embedded editor.
- JSON Escape & Unescape
Escape or unescape strings for code, logs, and API payloads.
- JSON Flattener
Flatten nested JSON into a single-level object with dot or underscore keys.
- JSON Formatter & Beautifier
Format, prettify, and beautify messy JSON with configurable indentation and key sorting.
- JSON Merge Tool
Deep-merge two JSON objects — nested keys combine, arrays and scalars override.