NDJSON
Also called JSON Lines, JSONL
NDJSON (newline-delimited JSON), also called JSON Lines or JSONL, stores one JSON value per line. Each line can be parsed on its own, so large files and streams never have to be loaded at once. The file as a whole is not valid JSON, which lets producers append records.
In more detail
NDJSON, short for newline-delimited JSON, stores one complete JSON value per line. JSON Lines and JSONL are other names for the same format, usually with the .jsonl file extension.
Because every line stands alone, a program can read a huge file one record at a time, and a producer can append a record without rewriting the file. That is why logs, data exports, streaming APIs and machine learning datasets use it.
The file as a whole is not valid JSON. Parsing it with one JSON.parse call fails with an error about extra content after the first value. Split it into lines and parse each one, or use jq, which reads multiple values natively.
Each line must be compact. A pretty-printed object spread over several lines breaks the format.
Example
const text = '{"id":1,"event":"login"}\n{"id":2,"event":"logout"}\n'
const records = text
.split("\n")
.filter(Boolean)
.map((line) => JSON.parse(line))
// [{ id: 1, event: "login" }, { id: 2, event: "logout" }]Try it
Learn more in the guide JSON5, JSONC and NDJSON explained.
← Back to NDJSON in the JSON glossaryUpdated 2026-10-01