NDJSON Validator Online — Validate Newline-Delimited JSON

Paste NDJSON / JSON Lines and validate every line independently. Per-line ✓/✗ status with error messages — 100% in your browser.

Paste NDJSON or click Load Sample to validate every line.

What is an NDJSON validator?

An NDJSON validator reads a newline-delimited JSON file and checks every line independently. Each line should be a complete, parseable JSON value — typically an object. The validator reports per-line ✓/✗ status with the precise error message for any line that fails to parse, plus a summary count of valid, invalid, and blank lines.

NDJSON is the de facto format for structured logs (Pino, Bunyan, slog, zap), database exports (BigQuery, MongoDB), event streams, and ML datasets. Its append-friendly design makes it robust under failure — a half-written line at the tail doesn't corrupt the rest — but consumers vary in how strictly they enforce per-line validity. Validating before you ship is the cheap way to catch issues that downstream tools will reject silently.

How to validate NDJSON — 4 steps

  1. Paste NDJSON. Drop a log file, mongoexport dump, or BigQuery JSON export into the input. Click Load Sample for a file with one deliberate error to see the failure flow.
  2. Read the summary. The header shows how many lines parsed, how many failed, and how many were blank.
  3. Inspect failed lines. Each invalid line shows its number, the parser error message, and a preview of the offending content.
  4. Fix and re-validate. Edit the offending lines, paste back, and re-run until every non-blank line is green.

Common NDJSON errors

# 1. Trailing comma — valid JSON5, INVALID JSON
{"id":1,"name":"Alice",}

# 2. Single quotes — invalid JSON
{'id':1,'name':'Alice'}

# 3. Unclosed object — missing }
{"id":1,"name":"Alice"

# 4. NaN / Infinity — not valid JSON literals
{"id":1,"score":NaN}

# 5. Multi-line value — NDJSON requires one value per line
{"id":1,
 "name":"Alice"}

Per-Line Validation

Every line is parsed independently. Errors on one line never hide problems on the others — you see the full picture in a single pass.

Precise Error Messages

Each failure includes the exact JSON.parse error and a preview of the offending text so you can locate the issue in your editor instantly.

Client-Side Only

Validation runs in JavaScript on your machine. Logs with user IDs, IPs, or proprietary event data never leave the browser.

Common use cases

  • check_circleValidating Pino, Bunyan, slog, or zap log output before shipping to ELK / Loki
  • check_circleChecking mongoexport NDJSON dumps before mongoimport restores them
  • check_circleValidating BigQuery NEWLINE_DELIMITED_JSON loads to avoid bq load failures
  • check_circlePre-flight check on Kafka or Kinesis dumps before downstream replay
  • check_circleVerifying ML training datasets in JSON Lines format (e.g. for fine-tuning)
  • check_circleCatching log corruption from disk-full or container OOM kill events
  • check_circleTesting structured-logging library upgrades for output regressions
  • check_circleValidating Stripe webhook archives before reprocessing

Why per-line validation beats one big parse

If you wrap NDJSON in [ and ] and run JSON.parse, a single broken line takes down the whole file — you get one error message and have to bisect manually to find the culprit. The validator parses each line independently, so a corrupt line doesn't hide problems elsewhere. You see every error in one pass, which is the difference between fixing a file in one minute or spending fifteen minutes binary-searching through ten thousand lines.

Need to do more with NDJSON?

Browse, render to a table, or pretty-print individual records.

Frequently Asked Questions

What makes NDJSON valid?

Each non-blank line must be a complete, parseable JSON value — almost always an object. Lines are independent: a syntactically broken line does not invalidate the rest of the file. The line separator must be \n (LF) or \r\n (CRLF). Trailing whitespace inside a line is fine; trailing commas at the end of a line are not (that’s not valid JSON).

Are blank lines OK?

The original NDJSON spec says no — every line should contain a JSON value. In practice, almost all real-world tools (jq, Pino, BigQuery, MongoDB) tolerate blank lines and skip them. The validator counts blank lines separately and does not flag them as errors, so you can validate real-world files without false positives.

What is the practical max line size?

NDJSON itself imposes no limit, but consumers do. Many libraries default to 64KB or 1MB per line. BigQuery rejects lines over 100MB. For broad compatibility, keep records under 1MB per line — and if you need bigger payloads, store them as files referenced by URL rather than inlined.

NDJSON, JSONL, JSON Lines — same thing?

Effectively yes. NDJSON (newline-delimited JSON), JSONL, and JSON Lines all refer to the same format: one JSON value per line, separated by newlines. The validator treats them interchangeably. Minor spec differences exist (JSON Lines technically requires UTF-8; NDJSON allows BOMs in some interpretations) but they don’t affect typical use.

Why does my file fail validation?

The most common causes: (1) trailing comma at the end of an object (valid JSON5, invalid JSON), (2) single-quoted strings (Python-style, invalid JSON), (3) NaN, Infinity, or undefined (not valid JSON literals), (4) a JSON array spread across multiple lines — NDJSON requires the whole value on one line, (5) an unescaped newline inside a string.

Can it validate millions of lines?

The validator runs synchronously and reports every line. Browsers handle ~100k lines comfortably; beyond that the UI may stutter while rendering. For very large files, validate a representative sample — if the sample is clean and your producer is consistent, the rest is almost always fine.

Are duplicate keys flagged?

No — JSON.parse silently accepts duplicate keys (later wins), and so does NDJSON. If you need duplicate-key detection, run the lines through a stricter parser. The validator focuses on syntax-level validity.

Is my NDJSON sent to a server?

No. Validation runs entirely in JavaScript inside your browser — no upload, no telemetry. Open DevTools → Network and confirm. Log files often contain user IDs, IPs, and proprietary event data, so this matters in real-world use.

NDJSON Validator Online — Validate Newline-Delimited JSON