Sort JSONL Records by Any Key Path
JSONL sorter. Sort a JSONL (JSON Lines) file by a chosen key path, ascending or descending, numeric or lexical. Stable sort, missing-value handling configurable. Browser-only.
100% client-side. No upload.
Sort
JSONL Sorter
Sort a JSONL file by a chosen key path with stable ordering. Handles numeric, lexical, and ISO-date comparisons; lets you choose where missing values go. The browser equivalent of jq -s 'sort_by(.id)' without the pipe-friendly footguns. 100% client-side.
Comparison types
Auto-detect
Looks at the first non-missing value at the key path and picks the right comparator — numeric if it parses as a number, ISO-date if it matches a common date pattern, otherwise lexical. Good default.
Numeric
Coerces values with parseFloat. Non-numeric values are pushed to the
missing-values bucket. Use this for IDs, prices, durations.
Lexical
Standard string comparison using localeCompare with numeric-aware option, so
"file2" sorts before "file10".
Date / ISO timestamp
Parses with the browser's Date constructor. ISO 8601 timestamps
(2026-05-11T12:34:56Z) sort correctly; ambiguous formats (US vs EU) may not
— convert to ISO first if so.
Stability
The sort is stable: records that compare equal on the key keep their original input order. If you need a secondary sort key, run the sorter twice — sort by the less-important key first, then by the more-important key.
Tips & common pitfalls
- Use the right type for numbers.
"10"sorts before"2"lexically. Pick "Numeric" or "Auto-detect". - Dates need a parseable format. Stick to ISO 8601 or pre-normalize.
- Sort large files in a CLI for huge inputs. The browser holds the whole file in memory. Past ~500k records,
jq -sorsortis faster.
Before you start
The sorter orders records by the value at a chosen key path, ascending or descending, with numeric or lexical comparison.
How to use it
- Drop a file or paste JSONL.
- Type the Key path to sort by — e.g.
created_at,user.name,items.0.price. - Pick Numeric (treats values as numbers) or Lexical (string comparison).
- Pick Asc or Desc.
- Decide what to do with records that lack the key: keep at top, keep at bottom, or drop.
- Click Sort, then download.
Numeric vs lexical
Numeric sorts 10 after 9. Lexical sorts "10" before "9" because "1" < "9". Use numeric for IDs and amounts, lexical for names and labels.
Tips & common pitfalls
- ISO 8601 dates sort correctly lexically —
2026-05-12<2026-05-13. Use lexical for dates and timestamps. - Stable sort. Records with equal sort keys keep their original order — handy when you sort by date and want secondary order preserved.
- Need multi-key sort? Sort by the secondary key first, then by the primary. Because the sort is stable, the result is correctly ordered by both.
Frequently asked questions
What happens to records without the sort key?
You choose: top, bottom, or drop them from the output.
Can I sort by a computed value?
Not in this tool. Use the jq playground with sort_by(.foo + .bar) for derived sort keys.