Get Top N Rows from NDJSON Files Online
Extract the top N rows per group from NDJSON files directly in your browser. Get the top 5 products per category, highest scores per team, or any ranked subset — no upload required.
About this tool
Extract the top N rows per group from a NDJSON file — for example the 3 best-selling products per region or the 5 most recent orders per customer. Choose the group column, the ranking column, the sort direction, and N. The output preserves all original columns. Equivalent to SQL's PARTITION BY with ROW_NUMBER(). All processing runs locally in your browser.
Frequently Asked Questions
What does top-N per group do to a NDJSON file?
It returns the top N rows within each group, ranked by the column and direction you choose — equivalent to SQL's ROW_NUMBER() OVER (PARTITION BY group_col ORDER BY rank_col DESC) with a WHERE row_num <= N filter. For example, the 3 highest-revenue customers per region.
Does top-N per group preserve all columns in the NDJSON output?
Yes. All columns from the original file are preserved. Only rows that fall outside the top N within their group are excluded from the output.
What happens when there are ties at the Nth position in a NDJSON top-N operation?
Ties are broken using row_number(), so one row from the tied group is arbitrarily selected and the others are excluded. To keep all tied rows at the boundary, use the SQL Query tool with RANK() and filter WHERE rank <= N.
Is my data private?
Yes — completely. Your file is never uploaded to any server. Everything runs locally in your browser using WebAssembly — processing happens entirely inside your tab. Once you close the tab, nothing is retained.
What is the maximum file size?
The free limit is 50 MB. For larger files, performance depends on your device's available memory — most modern machines handle 500 MB to 1 GB comfortably.
Related Tools
Convert NDJSON to YAML Online
Convert NDJSON files to YAML directly in your browser. Download clean, human-readable YAML — no upload required.
Convert YAML to NDJSON Online
Convert YAML files to NDJSON format directly in your browser. No upload required — your data never leaves your device.
Convert NDJSON to XML Online
Convert NDJSON files to XML directly in your browser. Download a structured XML document with one element per row — no upload required.
Convert NDJSON to SQL Online
Convert NDJSON files to SQL INSERT statements directly in your browser. Copy or download the generated SQL — no upload required.
Convert NDJSON to Markdown Table Online
Convert NDJSON files to a Markdown table directly in your browser. Copy the output and paste it into any Markdown document.