What is NDJSON?
NDJSON (Newline Delimited JSON), also called JSON Lines or JSONL, is a text format where each line is a separate, self-contained JSON object. There are no commas between records and no wrapping array brackets — just one { } per line.
Because each line is independent, NDJSON files can be processed one record at a time without loading the entire file into memory. This makes it the preferred format for streaming pipelines, BigQuery loads, Elasticsearch bulk indexing, and Kafka topics.
When to use NDJSON
- Loading data into Google BigQuery (requires NDJSON/JSONL)
- Streaming records through Kafka or Kinesis
- Bulk indexing documents in Elasticsearch
- Processing large log files line-by-line with tools like
jq
- Machine learning pipelines where each line is a training example
- Any use case where a file is too large to fit in memory as a JSON array
Frequently Asked Questions
What is NDJSON?
NDJSON (Newline Delimited JSON) is a format where each line is a valid, standalone JSON object. Unlike a standard JSON array, there are no commas between records and no surrounding brackets. It is also known as JSON Lines (.jsonl) and is widely used in data engineering for streaming, BigQuery loads, and log processing.
What is the difference between JSON and NDJSON?
A standard JSON array wraps all records in [...] with commas between them — the entire file must be parsed before a single record can be read. NDJSON puts one JSON object per line with no surrounding structure, so each line can be read and processed independently. NDJSON is better for large files and streaming; standard JSON is better for small payloads and REST APIs.
What is the difference between NDJSON and JSONL?
They are the same format. NDJSON and JSONL (JSON Lines) both mean one JSON object per line. They use different file extensions — .ndjson and .jsonl — and were named independently, but are fully interchangeable. BigQuery documentation uses NDJSON; the JSON Lines spec uses JSONL.
Why does BigQuery use NDJSON instead of JSON?
BigQuery loads data from NDJSON files because each line is an independent record. BigQuery can split a large NDJSON file across many workers and load records in parallel without parsing the full structure. A standard JSON array requires a full parse before any record is accessible, making it unsuitable for parallel loading of large files.
How do I use NDJSON with jq?
Use the --raw-input flag with jq to process NDJSON line by line:
cat data.ndjson | jq -c '.' — pretty-print each record.
cat data.ndjson | jq -c 'select(.status == "active")' — filter records.
The -c flag keeps output compact (one line per record).
How do I convert NDJSON to a JSON array in Python?
Read the file line by line, parse each line with json.loads(), and collect the results into a list:
import json
with open('data.ndjson') as f:
records = [json.loads(line) for line in f if line.strip()]
This tool does the same conversion instantly in your browser.
What file extension should I use for NDJSON?
The two most common extensions are .ndjson and .jsonl. Both mean the same format. BigQuery uses .ndjson; the JSON Lines specification prefers .jsonl. Check your target system's documentation — this converter downloads files as .ndjson by default.
Does this converter send my JSON to a server?
No. All conversion happens entirely in your browser using JavaScript. Your JSON data is never sent anywhere — it never leaves your device. This makes it safe to use with sensitive, confidential, or proprietary data.