Guide

NDJSON vs JSON Arrays

Choose line-delimited records for streams and arrays for one complete JSON value.

Written by DevPouch Editorial TeamSource-review record dated 2026-10-02; see the scope and method below.

Reviewed against the listed primary reference and synthetic local workflow; this is not a runtime or security certification.

Related tools

The debugging problem

NDJSON allows per-line parsing and recovery, while a JSON array has delimiters and must parse as a whole document. The formats are not interchangeable.

A practical sequence

  • Check whether each nonblank line is complete JSON.
  • Report malformed line numbers without discarding good records.
  • Preserve order when exporting valid lines.
  • Use an array when the contract requires one JSON document.

Synthetic example

NDJSON:
{"id":1}
{"id":2}

JSON array:
[{"id":1},{"id":2}]

A failure to watch for

Pasting a pretty-printed JSON array into an NDJSON viewer creates several invalid lines rather than two records.

Limits and interpretation

Line-oriented parsing cannot recover a valid JSON value split across lines.

References

FAQ

What should I verify first when using this ndjson vs json arrays workflow?

Check whether each nonblank line is complete JSON.

What can this workflow not prove?

Line-oriented parsing cannot recover a valid JSON value split across lines.

Related guides

NDJSON vs JSON Arrays | DevPouch