JSON Lines / NDJSON
JSON Lines (also called NDJSON, newline-delimited JSON) is a convention: each line is a complete JSON value, usually an object, and lines are separated by \n. Log shippers, analytics exports, and some APIs use it because you can append a record without rewriting the whole file, and you can stream one line at a time.
It is not a single JSON array. If you paste an entire .ndjson file into a standard validator, it should fail. RFC 8259 describes one value. Two objects back to back — even on separate lines — are not one value. That failure is correct. The file is a sequence of documents.
What a file looks like
{"ts":"2026-09-05T09:00:00Z","level":"info","msg":"ok"}
{"ts":"2026-09-05T09:00:01Z","level":"warn","msg":"retry"}
There is no wrapping [...], no commas between records, and usually no pretty-printed newlines inside a record. A pretty-printed object contains raw newlines; those would look like extra “records” to a line splitter. That is why production JSON Lines stays compact per line. Pretty-print one record at a time when you need to read it.
How to inspect a record in JSON Quiet
- Open the log in a text editor. Copy one line, not the whole file.
- Paste that line into JSON Quiet.
- Validate in strict mode. If it fails, that record is broken — other lines may still be fine.
- Format with 2 or 4 spaces to read nested fields. See finding a key.
- If you must put the record back into a log, switch to compact and copy a single line again.
Do not wrap the entire file in brackets and sprinkle commas unless you are deliberately converting NDJSON into a JSON array for a tool that only accepts arrays. That conversion changes the format; streaming consumers will no longer be able to read line by line.
Blank lines and concatenated JSON
Some exporters insert blank lines. A blank line is not a JSON value. Skip it. Some systems write concatenated JSON without newlines ({}{}). That is another convention, harder to split. Prefer documented JSON Lines when you control the producer.
Duplicate keys inside one line are the same problem as in any JSON object: parsers disagree. Unique keys per record keep debugging boring — which is what you want at 3 a.m.
When validation of “the file” is the wrong question
Teams sometimes say “our export is invalid JSON.” Often the export is valid JSON Lines. The test is wrong. Decide the contract: “this endpoint returns one JSON document” versus “this file is NDJSON.” Then pick the checker. JSON Quiet validates one document. For a million-line dump, write a small loop in the language you already use, or validate samples.
Redact secrets before you paste a log line. Request IDs are usually fine. Session cookies and customer emails are not. Read what not to paste.
Related guides
Minify vs pretty-print · Validate RFC 8259 · Common errors · All guides