SmartQueryTools

Sort NDJSON Files Online

Sort NDJSON files by any column, ascending or descending, directly in your browser.

How to sort NDJSON files

  1. Drop your file onto the upload area. It is loaded into the in-browser engine and the first 200 rows are shown.
  2. Choose the first column in the Sort by row and set it to Ascending or Descending.
  3. Click + Add sort key to add a Then by row for breaking ties. You can use up to four keys, and ✕ removes one.
  4. Click Sort. The preview shows the first 200 rows in their new order.
  5. Click Download to save the sorted file in the same format you uploaded.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A teacher has exam results for two classes and wants each class grouped together, with the highest score at the top of each group. One student has no score yet.

Input (NDJSON)

{"student":"Priya","class":"B","score":88,"submitted":"2026-05-12"}
{"student":"Tom","class":"A","score":72,"submitted":"2026-05-11"}
{"student":"Lena","class":"A","score":91,"submitted":"2026-05-12"}
{"student":"Omar","class":"B","score":null,"submitted":"2026-05-13"}
{"student":"Jae","class":"A","score":85,"submitted":"2026-05-10"}

Settings

  • Sort by: class, Ascending
  • Then by: score, Descending

Result

studentclassscoresubmitted
LenaA912026-05-12
JaeA852026-05-10
TomA722026-05-11
PriyaB882026-05-12
OmarBNULL2026-05-13

Rows are first ordered by class, so all of class A comes before class B. Inside each class, the second key orders scores from high to low. Omar has no score, and empty values always go last, whether the direction is ascending or descending. That is why he stays at the bottom of class B.

Frequently Asked Questions

How many columns can I sort by?

Up to four. The first key decides the main order, and each Then by key only breaks ties left by the keys above it.

Where do empty values go?

NULL values are always placed last, in both ascending and descending order.

Is the text sort case-sensitive?

Yes. Values are compared by character code, so uppercase letters sort before lowercase. Convert the column to one case first if you want "apple" and "Apple" side by side.

Related Tools