Validate NDJSON before you ingest it
The NDJSON Validator checks a newline-delimited JSON file line by line and tells you precisely which lines are broken. Run it before a BigQuery load or an Elasticsearch bulk request so a single malformed record does not fail or corrupt the whole ingest.
How it works
The input is split on newlines and each non-blank line is parsed with
JSON.parse. Lines that parse cleanly count toward the valid total. Lines that
throw are collected as errors, each recorded with its 1-based line number, the
parser’s own error message, and an 80-character preview of the offending line so
you can locate it immediately.
Strict mode adds one more rule: a line must parse to a JSON object, not a bare value, array, or null. This matches how NDJSON is normally used — one record object per line — and flags structurally valid but semantically wrong lines. Blank lines are skipped entirely, so a trailing newline never registers as a failure.
Tips and notes
The most common real-world error is a stray trailing comma or an unquoted key from a hand-edited file — the line number and preview point you straight at it. Turn strict mode off if your pipeline legitimately accepts non-object lines, for example a stream of bare numbers. Once the report shows all lines valid, the file is safe to stream into a line-oriented loader.