JSON Converters Code Gen Formatters All tools Browse all tools built byAbhay Darji

JSON Sorter

Sort JSON object keys alphabetically, at any depth, to make two documents comparable.

100% client side No upload No size limit Works offline
Input
Output
Ready
Drop a file to load it

About this tool

Reorder object keys alphabetically throughout a document. The usual reason is comparison: two JSON files with the same content but different key order produce a noisy diff until both are sorted.

When you would use it

  • Normalising two payloads before diffing them
  • Producing deterministic output for a snapshot test
  • Making a large configuration file easier to scan

Worked example

Input
{"name":"Ada","age":36,"active":true}
Sorted
{
  "active": true,
  "age": 36,
  "name": "Ada"
}

Things worth knowing

  • Sorting is recursive by default and uses natural ordering, so item2 sorts before item10.
  • Array order is meaningful in JSON and is left alone unless you explicitly ask for arrays of scalars to be sorted.
Questions

Frequently asked

Does sorting change the meaning of my JSON?
No. Object key order is not significant in JSON and every parser treats the sorted and unsorted forms as equal. Array order is significant, which is why arrays are not reordered by default.
Is my data uploaded anywhere?
No. Every tool on JSONWorks runs entirely in your browser using JavaScript. Your input is never sent to a server, never logged and never stored. The simplest proof is to disconnect from the internet — the tools keep working. The site does load Google Fonts and a Google Analytics page-view tag, so you will see those two requests in your network tab, but neither receives anything you type or paste.
Does it work offline?
Yes. JSONWorks is installable as a progressive web app and caches itself on first visit, so every tool keeps working without a connection.
Related

Tools that pair well with this