A JSON sorter reorders object keys. It does not change values. After a successful JSON.parse, every object — including objects nested inside other objects and inside arrays — gets a deterministic key order. The array itself stays in the same item order. This JSON Sorter runs in the browser. Nothing is uploaded.
That is a different job from a JSON formatter. A formatter controls whitespace and indentation so the text is easier to read. Sorting changes which key comes first. This page prints indented output so you can see the new order; that indentation is presentation only. If you only want pretty-print and want to keep the original key order, use the JSON Formatter instead.
Developers sort JSON when they need a stable shape: a Magento or WordPress config dump in git, two API bodies to compare by eye, or a payload whose keys arrive in a different order on every request. JSON itself does not treat object member order as meaningful. Humans and diffs often do.
users array. Copy output writes the sorted text. Clear empties both boxes.Invalid JSON is not sorted. The status shows the browser parse error and the output box is cleared. Sorting always walks every nesting level. There is no “root only” switch, because a root-only sort would leave nested keys in a different order from the envelope and that is the usual source of confusion.
This object is the example on the page:
{
"name": "John",
"users": [
{ "z": 1, "a": 2 },
{ "b": 3, "a": 4 }
],
"age": 30,
"meta": {
"version": 1,
"created": "2026-01-01"
}
}
Ascending A → Z puts age first, then meta, name, users. Inside meta, created comes before version. The two user objects stay in the same array order; their keys become a then z, and a then b.
A flat object such as name, age, email becomes age, email, name when sorted A → Z. Values stay 30, the email string, and John.
Format answers “make this text readable.” Sort answers “put the keys in a stable order.” You can format without sorting, and you can sort and then minify. If you need a compact string after a sort, paste the output into the JSON Minifier. If you need to inspect nesting rather than rewrite keys, use the JSON Viewer. If you only need the field names, use the JSON Key Extractor.
Key order follows Unicode code-unit comparison. For ordinary English ASCII keys that is A–Z, then a–z. Descending reverses that comparison. The comparison does not try to be a locale-aware dictionary sort, because those rules differ by browser language.
Array item order is data. This tool does not reorder array elements, does not sort by a child field, and does not implement JSONPath. Objects found inside arrays are still key-sorted. A root array is legal: items stay put; nested objects are sorted. A root string, number, boolean, or null has no keys; the output is the same value, indented for reading, with a status that says so.
JSON.parse owns the value. Duplicate keys in the source text cannot be preserved; the last property wins in the browser.After you sort both sides, compare values with how to compare two JSON documents.
Parse and sort run in this browser. The payload is not sent to YallaSolve for this tool. Clear the tab if you pasted customer fields.
Sorts object keys at every nesting level. Array item order is kept. Indentation in the output is only presentation — this is not a JSON formatter.
No. A formatter changes whitespace. This sorter changes object key order at every nesting level and then prints indented JSON so you can read that order.
No. Only key order changes. Numbers, strings, booleans, and null stay the same. Array item order is also unchanged.
No. Array order is preserved. Objects inside arrays have their keys sorted. There is no JSONPath query and no sort-by-field for array elements.
JSON.parse resolves object properties. Duplicate keys in the source text cannot be listed or kept after parse; the last property wins in the browser.