JSON Sort Keys

Alphabetize the keys of a JSON object, recursively, so two documents with the same data produce the same text. Arrays keep their order. Runs in your browser.

Why sort JSON keys?

Object key order isn't significant in JSON, but it is significant to git diff and the human eye. Canonicalizing keys into a consistent (alphabetical) order means two equivalent objects produce identical text — so diffs show only real changes, config files stay tidy, and snapshots are stable. This sorts every nested object recursively while leaving array element order untouched (arrays are ordered data).

Related

JSON formatter  ·  JSON diff  ·  JSON viewer  ·  All tools