Array Sorter
Sort a JSON array numerically, alphabetically, naturally, by length, by date, or by a (dot-path, nested) object key -- ascending or descending, case-insensitive, with a secondary tiebreak key, null handling, and an original-position map so you can see exactly how items moved. Works on a JSON array, comma list or newline list. Nothing is uploaded.
What this tool does
This sorts the elements of an array — a list of values or records — not the key order inside a JSON object. Paste a JSON array, a comma list, or a newline list, pick how to compare the items, and get back the same list reordered, along with a map showing exactly which item moved where.
Six ways to compare values
- Numeric and alphabetical — the two obvious ones.
- Natural — treats embedded numbers as numbers, so "item2" sorts before "item10". A plain alphabetical sort puts "item10" first, because it compares character by character and "1" comes before "2".
- By length — shortest or longest string first.
- By date — parses each value as a date before comparing.
- Auto — numeric if every value is a number, alphabetical otherwise.
Case sensitivity for alphabetical sorting, and where nulls land (first or last rather than wherever they happen to fall), are both controlled separately.
Sorting a list of objects
When the array holds objects, sort by a specific field using a
dot-path — age, or something nested
like address.city — instead of comparing whole
objects, which wouldn't mean anything. A secondary
tiebreak key decides the order when two items match on the
first: sort a list of people by age, then by name, so people the
same age land in a predictable order instead of whatever order they
started in.
Seeing exactly what moved
Alongside the sorted result, a position map lists every item's original index next to its new one, highlighting the ones that actually changed position. That's the difference between trusting a sort happened correctly and actually being able to check it — useful when a list feeds into something order- sensitive downstream, or when the sort key turns up unexpected duplicates.
Privacy
Parsing and sorting both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.
Frequently asked questions
Is my data uploaded anywhere?
Does this sort the keys inside my JSON objects, or something else?
What is natural sort and why would I want it?
Can I sort by a nested property, like address.city?
address.city reaches into a nested object on each array element. A second, optional tiebreak key decides the order when two items match on the first.