{ }jsonkit
Tools/Format/JSON Sorter
Search tools…⌘K
Format
{ }JSON Formatter
≡→JSON Minifier
\"JSON Escape / Unescape
a→zJSON Sorter
⇄{}JSON Flattener
Validate
JSON Validator
±JSON Diff / Compare
§JSON Schema Generator
JWT Decoder
ΔJSON Patch / Merge Patch
kbJSON Size Analyzer
Convert
→csvJSON to CSV
csv→CSV to JSON
⇄ymlJSON ⇄ YAML
⇄xmlJSON ⇄ XML
→tsJSON to TypeScript
b64Base64 Encode / Decode
%2FURL Encode / Decode
clkTimestamp Converter
→zJSON to Zod
→pyJSON to Pydantic
→goJSON to Go
→javaJSON to Java
⇄jsonlJSON ⇄ JSONL
5→JSON5 / JSONC to JSON
Query
$.JSONPath / JQ Tester
.*Regex Tester
Generate
Mock JSON Data Generator
idUUID / NanoID Generator
#Hash Generator
a→z

JSON Sorter — Sort Keys Alphabetically

Recursively sort object keys for clean, diffable JSON.
processes as you type · client-side
Sample
Upload
Order
A→ZZ→A
Sort arrays
⧉ Copy output ⌘C
Download
Share
Clear
Input219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Sorted
codetree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
{ "active": true, "email": "ada@example.com", "id": "usr_8x42", "name": "Ada Lovelace", "plan": { "renews": "2026-08-01", "seats": 5, "tier": "pro" }, "roles": [ "editor", "admin" ] }
✓ valid (RFC 8259)219 B → 219 B0.0 msLn 1, Col 1UTF-8

About JSON Sorter

The JSON sorter reorders every object's keys alphabetically, recursively through the whole document, and pretty-prints the result. Two documents with the same data but different key order become byte-identical after sorting, which is exactly what you want before diffing, committing or deduplicating JSON.

Sorting runs entirely in your browser — nothing you paste is uploaded or logged — so it is safe for production payloads, configs with secrets and customer records. It is free, instant and needs no account.

Reach for it when a config file has grown messy from hand edits, when two API responses won't diff cleanly because the keys moved, or when you want stable, canonical JSON that produces minimal version-control noise.

How it works

Recursive key sorting

Every object in the document — top-level and nested at any depth — gets its keys re-emitted in alphabetical order. Values are untouched: numbers, strings, booleans and null come out exactly as they went in, only the key order changes.

A→Z or Z→A

Ascending alphabetical order is the default and the conventional canonical form. Flip the order control to Z→A when you want reverse order, for example to surface a particular group of keys at the top.

Sorting arrays — carefully

Arrays are left in their original order by default, because array position is often meaningful data. Turn on Sort arrays to also sort arrays of plain values (strings, numbers, booleans). Arrays that contain objects always keep their order — there is no single sensible way to rank objects, and silently choosing one would corrupt list semantics.

Why sorted JSON diffs better

Text diff tools compare line by line, so the same data with reordered keys shows up as a wall of changes. Sorting both sides first makes key order irrelevant, leaving the diff to show only real value changes — smaller pull requests and faster reviews.

Frequently asked questions

Does sorting JSON keys change the data?

No. The JSON specification says object key order carries no meaning, and every value is preserved exactly. Only the order in which keys are written changes — any standard parser reads the sorted document as identical data.

Are nested objects sorted too?

Yes. The sort is recursive, so objects inside arrays and objects nested many levels deep all get alphabetically ordered keys.

Why aren't my arrays sorted?

Array order is often meaningful — steps, rankings, coordinates — so arrays are preserved by default. Enable the Sort arrays toggle to sort arrays of plain scalar values; arrays of objects always keep their order.

Is my JSON uploaded to sort it?

No. Sorting runs entirely in your browser with JavaScript, so production payloads and configs with secrets never leave your machine.

When should I sort JSON keys?

Before diffing two documents, before committing config files to version control, or when generating canonical output for hashing and caching. Consistent key order eliminates noise so only real changes stand out.