JSON Sort Online — Sort Keys & Arrays Free
JSON sort online — alphabetize keys deeply or sort arrays of primitives/objects in one click. Case-insensitive, asc/desc, browser-based, no signup.
PDFFlare's JSON sort online tool sorts any JSON document deterministically — recursive key sort, optional array-element sort (primitives or by object key path), case-insensitive, asc / desc. Useful for canonicalizing JSON before diffs, hashes, or commits, and for cleaning up exported configs.
Need to compare two JSON values? JSON Diff. Format only? JSON Formatter (also has a sort-keys mode).
How to Sort JSON Keys and Arrays
Paste your JSON
Could be a config, a fixture, an export — any JSON document where you want predictable ordering.
Pick what to sort
Sort keys (deep, recursive), sort arrays of primitives, or sort arrays of objects by a key path. Optional case-insensitive and asc/desc.
Click Sort JSON
PDFFlare returns a deterministically-ordered version of the JSON. Use it as a stable canonical form for diffs, hashes, or commits.
When Do You Need to Sort JSON?
Reproducible hashes: Caching by JSON-content-hash requires a canonical form. Sort first, then hash — identical values produce identical keys.
Cleaner diffs: Two JSON files with the same data but different key orders show up as full-file changes in git diff. Sort both first; only the real changes show up.
Snapshot tests: Jest, Vitest, and Insta-style snapshot tests get noisy when JSON serialization order is non-deterministic. Sort before snapshotting for stable tests.
Reviewing config files: Sorted keys are easier to scan in a 100-key config. Especially for new contributors: alphabetical order means they don't have to know the project's convention.
Why Choose PDFFlare's JSON Sort Online Tool?
Deep + Configurable
Recursive key sort, optional array sort, asc/desc, case-insensitive — turn on what you need without rewriting a snippet.
Object-Array Sort
Sort an array of objects by any key path — id, createdAt, name — without writing a comparator.
100% Browser-Based
Your JSON stays on your device — safe for production payloads.
No Signup Required
No account, no rate limits.
Frequently Asked Questions About JSON Sort
Recursively sorts every object's keys alphabetically. {"b": 1, "a": {"d": 4, "c": 3}} becomes {"a": {"c": 3, "d": 4}, "b": 1}. Arrays keep their original order (array order is data, not just layout) — sorting array items requires the separate Sort arrays option.
PDFFlare's JSON Sort tool runs entirely in your browser. Array order in JSON is meaningful — [1, 2, 3] is not the same value as [3, 1, 2] for many use cases (event logs, ordered preferences, render order). Sort arrays only when you know order is incidental to the value, not part of it.
Specify a key path in the 'Object array sort key' field — e.g. id, name, createdAt. The tool sorts the array by that field's value. If the field is missing on some items they sort as empty strings; mixed types compare via stringified JSON. For more elaborate sort logic, post-process with a script.
When enabled, keys and string values compare via toLowerCase first. So {"Banana": 1, "apple": 2} sorts to {"apple": 2, "Banana": 1} alphabetically without case bias.
For chronologically reversed event lists (newest first), top-N reports, or any list where the largest/latest items should be visible first. Hits the same recursion paths as ascending; just flips the comparator.
Yes — that's a primary use case. Two semantically identical JSON documents can have different key orders and produce different SHA-256 hashes or noisy line-by-line diffs. Sort both first to get a canonical form: identical hashes for identical values, clean structural diffs.
Yes. Sorting doesn't drop or transform values — only key order (and array element order, when enabled) changes. {} and [] survive intact; null leaves stay as null entries at their key path.
No. Sorting runs entirely in your browser — safe for production payloads, internal exports, anything containing PII or secrets.