JSON format guide

NDJSON / JSON Lines Guide

NDJSON (newline-delimited JSON), often called JSON Lines, stores one complete JSON value per line. It is useful for logs, event streams, exports and large datasets because records can be processed incrementally without loading one giant array.

Quick answer

NDJSON is not one JSON document containing many records. Each non-empty line is its own JSON document, so a normal whole-document JSON parser will reject multiple NDJSON lines as a single input.

Why NDJSON streams well

A producer can append one record at a time and a consumer can parse line by line. That reduces memory pressure and allows processing to begin before the full dataset is available.

NDJSON vs a JSON array

A JSON array begins with [ and separates records with commas. NDJSON has no enclosing array and uses newlines as record boundaries. Each line must independently contain valid JSON.

Validation strategy

Validate each line separately and report the line number of failures. Blank-line handling depends on the application; many pipelines ignore empty lines, but you should define that behavior explicitly.

NDJSON example

{"id":1,"event":"login"}
{"id":2,"event":"purchase"}
{"id":3,"event":"logout"}

Related JSON tools and guides

Frequently asked questions

Is NDJSON valid JSON?

Each line is valid JSON, but the entire multi-line file is not one standard JSON document.

Is JSON Lines the same as NDJSON?

The names are commonly used for the same one-JSON-value-per-line pattern.

Why use NDJSON instead of a JSON array?

It is convenient for streaming, append-only logs and incremental processing of large datasets.

Source-backed reference

JSON standards quick reference

Concise, standards-backed facts for developers working with JSON debugging and validation. Each claim is linked to the evidence registry and resolves to a primary standard or platform reference so it can be independently verified.

JSON standard
JSON is a text format for serializing structured data, with syntax defined by interoperable standards rather than by FixTools.
Strings and object keys
JSON strings and object member names use double quotation marks. Single-quoted strings are not valid standard JSON syntax.
Trailing commas
Standard JSON grammar does not allow a comma after the final member of an object or the final element of an array.
Parser behavior
JSON.parse() parses JSON text into a JavaScript value and raises a SyntaxError when the input is not valid JSON.

Common invalid → valid JSON examples

Trailing comma

{"a":1,}{"a":1}

Single-quoted key

{'a':1}{"a":1}

Unsupported literal

{"score":NaN}{"score":null}

Built for verification, not just extraction

Direct answers are paired with source-specific evidence. This keeps technical claims independently verifiable and gives search and answer systems a clearer provenance trail than unsupported summary copy.