What is NDJSON?
NDJSON, short for newline-delimited JSON, is a text format where each line is one complete JSON object. The same format is called JSON Lines, and files usually carry a .jsonl or .ndjson extension. Because every line stands alone, an NDJSON file can be written one record at a time, streamed over a network, and read line by line without loading the whole file into memory.
That property makes it the default output for logs, data pipelines, model training sets and web crawls, where results arrive one at a time and can number in the millions.
What NDJSON looks like
{"url":"https://example.com/product/blue-hoodie","price":49.0}
{"url":"https://example.com/product/grey-hoodie","price":45.0}
{"url":"https://example.com/product/red-hoodie","price":52.0}
Three rules define the format: each line is a valid JSON value (in practice, an object), lines are separated by \n, and the file is UTF-8. There is no enclosing array and no comma between records.
NDJSON vs JSON
| JSON array | NDJSON / JSON Lines | |
|---|---|---|
| Structure | One document, [ {...}, {...} ] |
One object per line |
| Appending a record | Rewrite the closing bracket | Write a new line |
| Reading a huge file | Parse the whole thing, or use a streaming parser | Read one line at a time |
| A corrupted record | Can break the whole file | Breaks only its own line |
| Splitting for parallel work | Hard | Split on line boundaries |
| Content type | application/json |
application/x-ndjson (common) |
For a broader comparison including CSV and XML, see JSON, JSONL, CSV or XML.
Are NDJSON and JSONL the same?
For practical purposes, yes. NDJSON and JSON Lines were described separately, by different people, at around the same time, and they define the same thing: one JSON value per line. The main difference is naming. Tools such as BigQuery, pandas and most LLM fine-tuning APIs accept either.
How to read NDJSON
In Python:
import json
with open("results.jsonl") as f:
for line in f:
if line.strip():
record = json.loads(line)
print(record["url"])
With pandas, pd.read_json("results.jsonl", lines=True). On the command line, jq -c . results.jsonl processes each line, and wc -l counts records.
Common mistakes
- Pretty-printing records. A JSON object spread across several lines breaks the format. Each record must sit on one line.
- Wrapping the file in an array. The output is then plain JSON, and line-based readers fail.
- Ignoring a trailing empty line. Skip blank lines when reading.
- Mixing encodings. Keep files UTF-8.
NDJSON in web crawling
A crawl produces results incrementally and may produce a great many of them, which is exactly the shape NDJSON suits. Each discovered URL, or each extracted record, becomes one line, and you can start processing before the crawl ends.
Zenrows Crawl lets you download everything a crawl found as a single NDJSON file, named {crawl_id}.jsonl, at any time, including while the crawl is still running. Each line is a JSON object with the URL and, when you asked for content, the page's HTML. The Crawl guide shows the download alongside reading results as they arrive.
Frequently asked questions
What does NDJSON stand for?
Newline-delimited JSON. Every record is a JSON object on its own line.
What is the file extension for NDJSON?
.ndjson or .jsonl. Both are common and describe the same format.
Can a JSON parser read an NDJSON file?
Not as one document, because the file is not a single JSON value. Parse it line by line, or use a reader with a lines option, such as pd.read_json(..., lines=True).
When should I use NDJSON instead of CSV?
When records are nested or have varying fields, such as product data with lists of variants. CSV suits flat tables that open in a spreadsheet.
Go deeper on the blog
In the docs
Last updated: Oct 9, 2026