JSON Sorter
Sort JSON object keys alphabetically, at any depth, to make two documents comparable.
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
{"name":"Ada","age":36,"active":true}
{
"active": true,
"age": 36,
"name": "Ada"
}
Things worth knowing
- Sorting is recursive by default and uses natural ordering, so
item2sorts beforeitem10. - 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