About this tool
Sorted keys make JSON easier to scan, review and compare, and they keep diffs small when files are generated by different tools. This sorter only reorders object keys. Array order, number literals and string escapes stay exactly as they were.
How to use it
- Paste JSON or import a file.
- Choose the order, case sensitivity and whether nested objects are sorted.
- Copy or download the result.
Example
{"version":3,"name":"datapry","author":{"name":"Swarup","email":"hi@example.com"}}{
"author": {
"email": "hi@example.com",
"name": "Swarup"
},
"name": "datapry",
"version": 3
}Questions
- Does sorting change arrays?
- No. Arrays are ordered lists, so their items stay in place. Objects inside arrays still get their keys sorted.
- How are upper and lower case ordered?
- By default case is ignored, so "apple" comes before "Banana". Turn on "Case-sensitive" to sort by character code, which puts all capitals first. The order is the same in every browser.
- Why sort keys at all?
- JSON objects have no meaningful key order, so sorting gives every file a predictable layout. That makes reviews and diffs show real changes instead of keys that moved.