Bug Days
Developer guide

JSONL and NDJSON: Validate, Inspect, and Convert JSON Lines

Understand JSONL and NDJSON, isolate malformed line numbers without losing valid records, inspect a selected record, and export a safe JSON array for the next debugging step.

6 minute read JSON Lines and NDJSON debugging
A JSON Lines document being validated with records and paths highlighted

JSONL, JSON Lines, and NDJSON are names for the same useful convention: each non-empty line is its own complete JSON value. There is no surrounding array. That small difference makes the format friendly to streaming logs and large exports, but it also means a normal JSON parser cannot read the whole file at once.

Recognize a JSON Lines file

This is three JSON records, not one JSON array:

{"event":"started","id":1}
{"event":"finished","id":1,"durationMs":142}
{"event":"started","id":2,"ok":true}

Wrapping those values in [ and ] without adding commas would produce invalid JSON. Use the JSONL Viewer & NDJSON Validator to parse each line independently and inspect the records that succeed.

Find a bad line without discarding good records

A trailing comma, a truncated line, an unescaped quote, or an accidental log prefix can break a single record. The viewer reports the actual line number and preserves valid records in its preview. Filter the visible JSON when an export is noisy, then select a record to see a formatted value instead of scanning a long one-line payload.

Convert valid JSON Lines to a JSON array

After you decide how to handle invalid records, download the valid values as a conventional JSON array. That format can move into the JSON Formatter, a fixture file, or the JSON-to-code generator. Exporting valid records is deliberately explicit so a bad line is never silently treated as if it were good data.

Share a minimal safe reproducer

The viewer’s share link restores the input, filter, and parse action. Use it for a tiny synthetic example when asking why an ingestion pipeline rejects a record. Links can be read by anyone who receives them, so redact log messages, access tokens, customer data, internal hosts, and identifiers before sharing.

Continue reading