TOOLTIKI Lovable tool, really free
Developer Formatting

JSON key sorter

What to do
Indent

Processed in your browser · nothing is uploaded

Local · arrays keep their order, deliberately
Advertisement
320 × 100

Sorts object keys alphabetically at every level of nesting. Values, and the order of arrays, are untouched.

How to use the json key sorter

1 Paste your input. The result appears immediately.
2 Pick the operation you want.
3 Copy the result, or save it as a file.

The reason to do this is diffing. Key order carries no meaning in JSON, but it means everything to a text diff — two objects with identical data serialised by different languages produce a diff that appears to change every line. Sorting both first reduces that to the differences that are real. It is also the cheap way to make a config file reviewable in a pull request. One thing deliberately not done: array order is significant in JSON, so sorting an array would change the data rather than its presentation.

Questions

Not to the standard or to any parser. It matters a great deal to a text diff, which is why sorting helps.

ECMA-404 — the JSON data interchange syntaxMDN — JSON.parse()
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING