JSON guide · 6 min read
JSONL vs JSON: Differences, Examples and When to Use Each
Understand JSONL and NDJSON, how they differ from regular JSON arrays and why line-delimited formats suit streaming data.
What is JSONL?
JSON Lines, also called JSONL or NDJSON, stores one complete JSON value on each line. The file as a whole is not one JSON array; each line is parsed independently.
{"id":1,"event":"created"}
{"id":2,"event":"updated"}How regular JSON differs
A standard JSON document has one top-level value. Multiple records are commonly wrapped in an array, so the parser usually reads the complete document before returning the result.
[{"id":1,"event":"created"},{"id":2,"event":"updated"}]When JSONL is useful
JSONL works well for logs, exports, machine-learning datasets and streaming pipelines because each record can be processed separately.
- Append records without rewriting an array.
- Report line-level parse errors.
- Process data incrementally.
- Split files by line boundaries.
Important limitations
Pretty-printing an individual record across multiple lines breaks the one-record-per-line convention. Blank lines and comments may also require application-specific handling.
Common questions
Frequently asked questions
Are JSONL and NDJSON the same?
They are commonly used for the same newline-delimited JSON format, although individual tools may define minor handling differences.
Is a JSONL file valid JSON?
Each line should be valid JSON, but the complete multi-line file is generally not one valid standard JSON document.