SmartQueryTools

Convert NDJSON to TSV Online

Convert NDJSON files to TSV format directly in your browser. No upload required — your data never leaves your device.

About converting NDJSON to TSV

Log and event data often goes straight to command-line tools, and TSV is the easiest shape for them. After converting NDJSON to TSV you can run cut -f3 to pull the service column, sort | uniq -c to count lines per service, or awk to keep rows where the status field is 500 or more, all without writing a jq filter.

Messages are where this breaks. Log lines often include a msg or stack field with embedded newlines, encoded as \n in the JSON. In TSV those become real line breaks, and the field is wrapped in double quotes. Quote-aware readers such as pandas, PostgreSQL in CSV mode and spreadsheet imports handle that, but cut, awk and grep will see one stack trace as many separate rows. Drop that key with Manage Columns, or replace the newlines, before converting.

As with every NDJSON load here, lines are parsed strictly. A blank line is ignored, but one truncated or non-JSON line stops the conversion and reports its line number. Keys that appear only on some lines still get a column, left empty elsewhere, and nested objects such as the req and res objects in pino-http logs are packed into one field as JSON text unless you flatten them first.

Worked example

A small sample file, converted with the default settings.

Input (NDJSON)

{"ts":"2026-03-02T14:05:11.042Z","level":"info","service":"checkout","status":200,"latency_ms":41.7,"user_id":"u_1842"}
{"ts":"2026-03-02T14:05:12.310Z","level":"error","service":"checkout","status":502,"latency_ms":3012.4,"user_id":null}
{"ts":"2026-03-02T14:05:12.877Z","level":"info","service":"search","status":200,"latency_ms":12.9,"user_id":"u_0077"}
{"ts":"2026-03-02T14:05:14.105Z","level":"warn","service":"search","status":429,"latency_ms":0.8,"user_id":"u_1842"}

Output (TSV)

ts	level	service	status	latency_ms	user_id
2026-03-02T14:05:11.042Z	info	checkout	200	41.7	u_1842
2026-03-02T14:05:12.310Z	error	checkout	502	3012.4	
2026-03-02T14:05:12.877Z	info	search	200	12.9	u_0077
2026-03-02T14:05:14.105Z	warn	search	429	0.8	u_1842

What changes when you convert NDJSON to TSV

  • Fields are separated by tabs, under a header row built from the keys on all lines.
  • Timestamps like 2026-03-02T14:05:11.042Z pass through as text, and because they are year-first they sort correctly with sort.
  • The null user_id on the error line leaves an empty last field.
  • Only values containing a tab, newline or double quote are quoted. Commas are left alone.
  • Nested objects and arrays become compact JSON text, such as ["a","b"].

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.

Frequently Asked Questions

Why does awk count more rows than there are log lines?

Some values contain line breaks, usually stack traces or multi-line messages. They are quoted in the TSV, but awk does not understand quotes and treats each physical line as a record. Remove or clean that column before converting, or read the file with a quote-aware tool.

Can I choose which keys become columns?

The converter writes every key found in the file. Run Manage Columns on the NDJSON first to keep only the fields you need, which also keeps the TSV narrow enough for cut and column -t.

Is the first line of the TSV a header?

Yes, it lists the key names. Skip it in shell pipelines with tail -n +2, or use NR > 1 in awk.

What is TSV format?

TSV (Tab-Separated Values) is similar to CSV but uses tab characters as delimiters — useful when data values contain commas.

Related Tools