Reading JSONL Logs and NDJSON Records | NDJSON Viewer Docs
Reading JSONL Logs and NDJSON Records
Long before anyone called it a data format, newline-delimited JSON was the answer to a very narrow question: how do you keep writing to a file while something else reads it? The answer turned out to suit a lot of other jobs, and JSONL is now the default shape for logs, exports, and training data alike.
Why logs are written one record per line
A log writer has exactly one append operation available. If each line is a self-contained JSON value, four things become free:
- Append-only writes. The process opens the file once and writes with
O_APPEND. No seek to the end, no read-modify-write, no chance of clobbering a record another thread already wrote. - Cheap tailing.
tail -f log.jsonlstreams new lines as they land, andgrep '"level":"error"'works without any parsing. Rotation is a rename plus a fresh file, with no truncation window. - Partial recovery. After a crash, every record written before the last newline is intact. A half-written final line is the only casualty, and it is one line.
- Structure with grep. The format is still plain text, so every tool you already own works on it, and you get typed fields when you parse it.
This is why log shippers (Fluent Bit, Vector, Fluentd) and tracing backends (OpenTelemetry Collector, Jaeger, Tempo) default to it. They receive events out of order, buffer them, and flush them as newline-delimited JSON — a format their downstream consumers can read incrementally and their upstream buffers can append to safely.
A realistic server log
Four lines from a Node service, written by a JSON logger:
{"ts":"2026-01-15T10:00:00.114Z","level":"info","service":"api","msg":"listening","port":8080}
{"ts":"2026-01-15T10:00:07.902Z","level":"info","service":"api","msg":"request","method":"POST","path":"/v1/orders","status":201,"ms":41}
{"ts":"2026-01-15T10:00:09.470Z","level":"warn","service":"api","msg":"slow query","ms":1874,"table":"orders","rows":0}
{"ts":"2026-01-15T10:00:11.006Z","level":"error","service":"api","msg":"upstream timeout","upstream":"billing","ms":5000}The schema is flat, consistent, and completely unpadded. Level filtering, timestamp sorting, and grouping by service are all plain text operations, and the same file parses cleanly in jq, pandas.read_json(lines=True), or the NDJSON Viewer.
Triaging a log file record by record
The real payoff is record-at-a-time inspection. When an incident starts, the questions are always the same, and NDJSON answers them without loading anything:
- How many records, and how many are broken? Totals for records, valid, invalid, and empty lines tell you in one glance whether the file is trustworthy.
- What is the first thing that failed? Filter to the invalid records, which stay in source order, and read the earliest error. In a log, the first failure is almost always the cause.
- What does the raw line actually say? The parser's message names a column, but the raw text shows the truncation, the stray comma, or the unescaped newline that caused it.
- What surrounds it? The raw-line inspector lets you read the neighbouring records without losing your place, which is where the context for the failure usually lives.
- Which records do I keep? Export the valid set and you have a clean file with every casualty preserved separately.
Search across the raw line text, filter by a property such as level = error, and the log shrinks to exactly the records you need to read.
LLM training and evaluation datasets
The same format dominates machine learning. Fine-tuning exports from OpenAI-compatible pipelines, evaluation harness fixtures, and preference datasets are all published as JSONL so a training loop can read one example at a time and shuffle it with a constant memory footprint instead of deserialising a multi-gigabyte array. Model and dataset releases on Hugging Face ship the same way, sharded into .jsonl files.
Because each row is a complete prompt-and-completion pair, a malformed row is a single bad example rather than a broken download. Spotting it, reading it, and excluding it is a per-record operation — which is exactly what the invalid-only filter is for.
BigQuery and Dataproc exports
bq export and Dataproc write query results as newline-delimited JSON, typically gzip-compressed into .jsonl.gz. The NDJSON Viewer reads plain text, not gzip — decompress the archive first and drop in the resulting .jsonl. Each row becomes one line, so an export of a two-billion-row table streams into a consumer without a schema negotiation step and without buffering the result set in memory. The same files load straight back with bq load or pandas, which is why exports are re-imported rather than re-generated.
Read your own data
Drop a .log, .jsonl, or .ndjson file into the NDJSON Viewer, or paste it directly. Everything runs locally in your browser — no upload, no backend.