NDJSON Tools
Validate line by line, convert to and from a JSON array, filter records with a JSONPath query, or summarise what is actually in the file. One JSON value per line — the format log pipelines and data exports use, and the one a normal JSON parser refuses.
Result will appear here
JSONPath over the record list
In filter mode $ refers to the
list of records, so the familiar array form works and you can pull a slice out of a log without loading it
into anything:
$[?@.level == "error"] records whose level is error $[?@.status >= 400] failing requests $[?@.user.id == 4172] a nested comparison $[?@.error] records that have an error field at all $[?match(@.path, "/api/.*")] path matching, using RFC 9485 I-Regexp
Queries are evaluated by the
same RFC 9535 engine that scores 703/703 on the official compliance
suite, so comparisons are strictly typed — @.status == "404" will not match the number
404. Lines that do not parse are skipped and counted rather than stopping the filter, which
matters on a log where one truncated line should not cost you the rest of the file.
The things real files contain
Blank lines and CRLF
Blank lines are ignored, as the format requires, and counted so you know they were there. Windows CRLF endings and lone CR are both handled, and reported.
A byte order mark
PowerShell's Out-File and several Windows editors add one. It is skipped rather than
breaking the first record, and mentioned so you can strip it at the source.
Large integers
Converting to an array copies each record's text rather than re-serialising it, so a 64-bit ID survives exactly instead of being rounded through an IEEE 754 double.
What defines NDJSON
Nothing at the IETF. NDJSON is described by the ndjson specification and by jsonlines.org, which agree with one another: UTF-8, one JSON value per line, newline separated, blank lines ignored.
It is worth not confusing it with
RFC 7464 — JSON Text
Sequences, which solves the same problem with a 0x1E record separator instead of a newline and carries
the media type application/json-seq. Either way each record itself follows
RFC 8259.
Where to go next
- JSONPath tester — build the query first if it is not matching
- JSON → CSV — convert to an array here, then to CSV there
- Formatter — for a single record you want to read
- Error registry — look up the message from a failing line