Parse NDJSON (Newline-Delimited JSON)
NDJSON stores one JSON object per line, enabling streaming and line-by-line processing. Common in logs, API streaming, and big data pipelines.
- 1
NDJSON (also JSONL) puts one complete JSON object on each line, with no commas or wrapping array. Advantages: streamable (process line by line), appendable (add new lines without rewriting), fault-tolerant (one bad line does not invalidate the rest). Common in log files, Kafka, and BigQuery exports.
- 2 JSON Validator →
Validate each line as a separate JSON object. Unlike regular JSON, you cannot parse the entire file as one value — split by newlines and validate each line independently. Skip empty lines and report invalid lines with their line number.
- 3 JSON Formatter →
Format individual JSON objects from the NDJSON stream. Each line is a standalone JSON object — format it for inspection. This is useful for debugging log entries or API streaming responses.
- 4
Processing NDJSON: read line by line (do not load the entire file into memory), parse each line as JSON, handle parse errors per line (log and continue or abort), process the object. For large files, use a streaming reader (Node.js readline, browser ReadableStream). For output, write each result as a new NDJSON line.
Frequently asked questions
- NDJSON vs JSON array — which to use?
- Use NDJSON for streaming, logs, and large datasets (each line is independent, can be appended). Use a JSON array for small datasets that need to be loaded entirely (atomic, easier to validate). NDJSON is better for big data; JSON arrays are better for configuration.
- How do I handle invalid lines in NDJSON?
- Parse each line independently and handle errors per line. Options: skip and log (fault-tolerant), abort on first error (strict), or collect all errors and report at end. For logs, skip and log the error line. For data import, abort to ensure data integrity.
Workflows that solve this
Learn more
Want to understand why?