JSON Key Sorter
Sort the keys of a JSON object A to Z, Z to A or in natural order, at every level or only the top. Good before comparing two files.
How it works
Puts the keys of every JSON object in order, at every level or only the top one. Choose A to Z, Z to A, natural order or plain character-code order. It tells you how many objects actually changed.
- Paste your JSON.
- Pick an order and whether to go deep.
- Copy the sorted result.
Worked example
{"b":1,"a":2} becomes {"a":2,"b":1}. With natural order, "item2" comes before "item10". With character-code order, "Zebra" comes before "apple" because capitals sort first.
Good to know
- Sort both files the same way before comparing them. Then a diff only shows real changes.
- Lists keep their order unless you tick the box, and lists of objects are never reordered.
- Natural order is best for keys that end in numbers.
Common questions
- Why do number keys stay at the front?
- JavaScript always stores keys that are whole numbers first, in number order. No tool that runs on JavaScript objects can change that. The note appears when your JSON has such keys.
- Does sorting change what the JSON means?
- No. JSON objects are unordered, so the data is the same. Only the text layout changes.
- What is the difference between A to Z and character-code order?
- A to Z follows language rules, so "apple" comes before "Zebra". Character code puts every capital letter before every small letter.
- Is my JSON uploaded?
- No. It is sorted in your browser.
More in Data.
The full ASCII chart with decimal, hex, octal and binary codes. Search by character, number or name.
OPEN →CSV AnalyzerSee what is inside a CSV: each column's type, missing values, unique values, and min, max and average.
OPEN →CSV CleanerTidy a messy CSV: trim spaces, drop empty rows and columns, and even out short rows.
OPEN →