SmartQueryTools

Convert TSV to NDJSON Online

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

About converting TSV to NDJSON

TSV to NDJSON is a bridge between two line-oriented formats. Both keep one record per line, so both suit the same Unix habits: head, tail, split, grep and streaming through a pipe. The difference is that each NDJSON line describes itself. It carries its own field names and JSON types, so a consumer does not need to know the column order.

Typical uses are loading tab-delimited exports into BigQuery or a document database, pushing records onto a message queue or into a log pipeline, and feeding tools built for JSON, such as jq. Large TSVs from analysis pipelines are a good fit, because both the input and the output can be processed one line at a time.

Check two things before converting. First, headerless files give every line keys like column0 and column1, which make poor field names. Second, only an empty field becomes null. R's NA, VCF's dot and database \N markers are written as strings. Also compare the row count shown after loading with what you expect: a stray tab inside one TSV row can stop the file from splitting into columns at all.

Worked example

A small sample file, converted with the default settings.

Input (TSV)

symbol	chrom	description	tpm	detected
TP53	chr17	tumor protein p53	24.7	true
BRCA1	chr17	BRCA1 DNA repair associated	8.13	true
NT5C	chr17	5', 3'-nucleotidase, cytosolic	3.4	true
SREBF2	chr22	sterol regulatory element binding transcription factor 2		false

Output (NDJSON)

{"symbol":"TP53","chrom":"chr17","description":"tumor protein p53","tpm":24.7,"detected":true}
{"symbol":"BRCA1","chrom":"chr17","description":"BRCA1 DNA repair associated","tpm":8.13,"detected":true}
{"symbol":"NT5C","chrom":"chr17","description":"5', 3'-nucleotidase, cytosolic","tpm":3.4,"detected":true}
{"symbol":"SREBF2","chrom":"chr22","description":"sterol regulatory element binding transcription factor 2","tpm":null,"detected":false}

What changes when you convert TSV to NDJSON

  • Each TSV data line becomes one line of compact JSON, in the same order.
  • Field names repeat on every line: symbol, chrom, description, tpm, detected.
  • SREBF2's line includes "tpm":null rather than leaving the key out.
  • NT5C's comma-filled description is a quoted JSON string on a single line.
  • There is no enclosing array and no comma at the end of each line.

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

How do I load the NDJSON into BigQuery?

Choose JSONL (newline-delimited JSON) as the source format, or run bq load --source_format=NEWLINE_DELIMITED_JSON with --autodetect or your own schema. Decimals load as FLOAT64 and true/false as BOOL.

Can I filter the output with jq?

Yes. jq reads one object per line by default, so jq -c 'select(.tpm > 10)' genes.ndjson keeps only matching records and writes them back as NDJSON. A null is never greater than a number, so SREBF2 would be dropped.

Is NDJSON bigger than the TSV?

Yes, often two to three times bigger, because every line repeats the field names and adds quotes and braces. Compress it with gzip for transfer. BigQuery and most loaders accept gzipped NDJSON.

What is NDJSON format?

NDJSON (Newline-Delimited JSON) stores one JSON object per line, making it easy to stream, append, and process incrementally.

Related Tools