https://devtools.solutions/tools/json/json-sort-keys.html

Sort JSON Keys

Sort all keys in a JSON object alphabetically at every level of nesting.


    

JSON Tool FAQ

How do I validate JSON?

Paste JSON into the input box and click Validate. The parser checks the content directly in your browser.

Can I minify large JSON payloads?

Yes. Click Minify to remove extra whitespace and reduce payload size for transport or storage.

What does optimize/compress do?

It minifies JSON and reports how many characters were removed compared with pretty-printed output.

Does this tool send data to a server?

No. Formatting, validation, and minification are performed client-side only.

Example input/output

Input: {"z":"last","a":"first","m":"middle"}

Output: {"a":"first","m":"middle","z":"last"}

How it works

This tool parses the JSON, then recursively rebuilds the object by sorting each level's keys alphabetically using Array.sort(). The sorted object is then re-serialised with JSON.stringify for display. Processing runs in your browser.

Common use cases

Related tools