Contact

Tools  /  JSON  /  Array Sorter

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-pathage, 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?
No. Parsing and sorting both run locally in your browser — nothing is sent to a server.
Does this sort the keys inside my JSON objects, or something else?
Something else — this reorders the elements of an array (a list of values or records), not the key order inside each object. If you need object keys themselves sorted alphabetically, that’s a different, more common kind of "JSON sorter" tool.
What is natural sort and why would I want it?
A plain alphabetical sort compares character by character, so "item10" comes before "item2" — "1" is a smaller character than "2". Natural sort treats the embedded numbers as numbers, so "item2" correctly comes before "item10", matching how a sensible sort should behave.
Can I sort by a nested property, like address.city?
Yes — the sort key accepts a dot-path, so 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.
How are ties and missing or null values handled?
A secondary tiebreak key breaks ties on the main sort key. Separately, you choose whether items with a null or missing value at the sort key sort to the front or the back, rather than landing wherever the sort algorithm happens to put them.
What input and output formats does it support?
Input can be a JSON array, a comma list, or a newline list, detected automatically or set explicitly. Output can be JSON (compact or pretty-printed), a comma list, or a newline list.
Theme Accent