JSON Lines / NDJSON

JSON Lines

JSON Lines — also written NDJSON — is one complete JSON object per line. It is barely a format at all, which is exactly why it works so well for streams.

Type information
Strings, numbers, booleans, null
Structure
One nested object per line
Compression
None
Typical file size
Slightly under JSON
Schema
Implicit, per line
Human-readable
Yes, one record at a time
Tool support
Log pipelines, LLM training sets, BigQuery

JSONLParquet

Runs on your device
Options

Reading JSONL

Writing Parquet

Parquet is unreadable in a text editor. That is by design.Check your new Parquet file with ParquetReader — opens Parquet files directly.

The entire specification fits in a sentence: each line is a valid JSON value, and lines are separated by newlines. There is no enclosing array and no commas between records. That means a reader can process line one without having seen line two, and a writer can append a record by writing a line — neither of which is possible with a JSON array.

This is why it dominates anywhere data arrives continuously: application logs, event streams, message queue dumps, and the export format of most analytics platforms. It is also the standard shape for machine learning datasets, where each line is one training example.

The cost is size and rigidity. Field names repeat on every line, so the file is larger than the equivalent CSV, and a standard JSON parser will reject the file outright because it is a sequence of documents rather than one. For analysis rather than transport, converting to Parquet is usually the right next step.

What JSONL is good at

  • Streams: a consumer can start work on the first line immediately.
  • Appends cheaply — no file rewrite needed to add a record.
  • One corrupt line does not invalidate the rest of the file.
  • Works naturally with line-based tools such as jq, grep and awk.

Where it falls short

  • Not valid JSON as a whole document.
  • Keys repeat on every line, so files are larger than tabular equivalents.
  • No schema, and fields commonly drift over time.
  • No compression of its own.
FAQ

JSONL questions

Are JSONL, NDJSON and JSON Lines different formats?
No. They are three names for the same convention. The .jsonl and .ndjson extensions are interchangeable.
Why does my JSON parser reject a JSONL file?
Because it is not one document. The parser reads the first object, then finds another object where it expected end-of-input, and stops. The file must be read line by line, or converted to a JSON array first.
What happens to a truncated last line?
It is skipped and reported. Log files copied while being written commonly end mid-record, so this is treated as expected rather than fatal.

Other format guides: CSV · Parquet · JSON · Excel · TSV