Transform

Order JSON array objects alphabetically, numerically, or chronologically by any key

Sort JSON objects alphabetically, numerically, or chronologically by any property key.

🛡️ Your rows never leave your browser.
Why Onfyt: Automatically applies typed comparison (numeric, date, or locale-aware text) so numbers like 100 don't sort before 20.

Interactive Sample Data

idproductpricestock
101Wireless Mouse25.00150
102Mechanical Keyboard85.0045
103USB-C Hub45.0080

How this tool works

APIs, NoSQL document queries, and microservice logs rarely return data in the exact order required for downstream reporting. A customer list might arrive sorted by internal database ID, but your sales team needs it sorted alphabetically by company name, or an e-commerce catalog needs to be ordered by price descending. Sorting JSON arrays manually or via ad-hoc scripts often introduces subtle bugs. In JavaScript, for instance, array.sort() defaults to string comparison, ordering the numbers [9, 80, 100] as [100, 80, 9] because '1' comes before '8'. Similarly, sorting date strings requires proper ISO 8601 parsing so year, month, and day are evaluated chronologically rather than as raw characters. DataFix detects the underlying data type of the chosen key—numbers, calendar dates, ISO timestamps, or text strings—and applies the appropriate sorting comparator. You can sort in ascending (A-Z, 0-9) or descending order, specify multi-level secondary sorting (e.g. sort by 'department' then by 'salary'), and designate whether null values appear at the beginning or end.

Things that usually go wrong

  • Sorting by a field that contains both strings and numbers produces undefined order — normalise the field type first.
  • Missing field values sort to the end.

Edge cases we tested

🧪 Numbers stored as strings ('"100"' vs '"20"')

Parsed numerically to prevent lexical sorting errors.

🧪 ISO timestamps with differing timezone offsets

Converted to UTC epoch milliseconds before comparison.

🧪 Missing or null key values on some objects

Grouped at the end (or beginning) based on user preference.

Frequently Asked Questions

Can I sort by multiple fields?

Yes — enter multiple field names and each is used as a tie-breaker.

Is the sort stable?

Yes — items that compare equal retain their original order.

Can I sort by a nested field?

Yes — use dot notation: 'user.lastName' to sort by a nested field. Arrays inside objects use index notation: 'items.0.price'.

Can I sort by multiple fields at the same time?

Yes — add multiple sort fields in order of priority. The array is sorted by the first field; ties are broken by the second field, and so on.

Does sorting preserve objects that are missing the sort field?

Yes — objects missing the sort field are placed at the end of the output in their original relative order.

Related tools

Transform

Column to Comma-Separated List

Extract a CSV column and convert it to a comma-separated list for SQL IN clauses or code arrays.

Open Tool →
Transform

Comma-Separated List to Column

Convert a comma-separated, line-separated, or SQL IN list into a single-column CSV.

Open Tool →
Transform

Lines to CSV

Convert plain-text newline-delimited records into structured CSV tables.

Open Tool →