The format for streams, logs, and ML datasets
JSON Lines (sometimes NDJSON — newline-delimited JSON, the same thing) is a file format where each line is one independent JSON value. No enclosing array, no commas between records, no top-level structure. The file extension is .jsonl or .ndjson.
What it solves that JSON doesn't
- Streaming — you can append a record by appending one line. With a regular JSON array, you'd have to rewrite the closing bracket on every append.
- Partial reads — process records one at a time without loading the whole file. Critical for log files and big datasets.
- Easy concat / split —
cat a.jsonl b.jsonlis the union;split -l 1000 huge.jsonlsplits into chunks. Both work because each line is self-contained. - grep-friendly —
grep error events.jsonlfinds matching lines without parsing.
Where you'll meet JSON Lines
- Application log files (
papertrail,vector.dev,fluentd). - ML training data (HuggingFace datasets, OpenAI fine-tuning, instruction tuning).
- Database exports (MongoDB
mongoexport, Firestore exports). - Anything tailing live events.
Principle: when your data is a sequence of records (log events, training samples, time-series rows), reach for JSONL, not a top-level array. Append-only is cheap, parsing is record-at-a-time, and the file scales to gigabytes without breaking the parser.