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
Input JSON
Sorted JSON

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.

No uploadsNo sign-upOpen source
  1. 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.

  2. 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.

  3. 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.

  4. 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

Learn more in our guides

All guides