NDJSON Validator: Validate, Convert and Filter JSON Lines
Short answer: NDJSON (also called JSON Lines, .jsonl) stores one JSON value per line, which suits logs, exports and streaming. A normal JSON validator rejects such a file as a whole. The NDJSON / JSON Lines Tool checks every line separately, so one bad record never hides the others, and it can convert, format, filter and summarise the records. Large files are read in pieces and never leave your browser.
Why a normal JSON validator fails
A file with two objects on two lines is not one valid JSON document. Each line is. That is why you need a line-by-line check. For a single document, see JSON syntax errors.
The five operations
- Validate each line: every line is listed as ✓ or ✗ with the exact reason, the column and the text around it. Blank lines are skipped. Turn on fail-fast to stop at the first problem.
- NDJSON → JSON array and JSON array → NDJSON: records are copied token for token, so large numbers, key order and string escapes are never changed.
- Format each record: compact (valid NDJSON) or pretty-printed, optionally with sorted keys. Duplicate keys are reported. Pretty output is readable but is no longer NDJSON.
- Filter / select records: keep records that match an expression and reduce each to chosen fields.
- Count & analyse: record counts, value types, line lengths, distinct record shapes and how consistently each field appears, which is the fastest way to spot mixed record shapes.
Filter syntax
Filters use the same engine as the JSONPath Tester. Write @ for the record:
@.level == 'error'@.status >= 500 && @.user.plan != 'free'match(@.path, '^/api/')@.errorkeeps records that have anerrorfield$.user.emailkeeps records where a value is found
"Text contains" is a plain search of the raw line. Criteria combine with AND, and Invert flips the result. For the language itself, see the JSONPath cheat sheet.
Precision warning: selected fields are re-written by the browser, so integers beyond 9,007,199,254,740,991 lose precision there. A plain filter keeps each matching line exactly as it was.
Repairing a bad file
After a run you can download the full result, only the valid records, or only the invalid lines exactly as they appeared, so you can repair them separately. For one broken record, see JSON Repair and fixing invalid JSON from ChatGPT.
How to use the NDJSON validator
- Open the NDJSON / JSON Lines Tool.
- Paste text or drop a
.ndjson,.jsonl,.jsonor text file. - Choose an operation and set options such as "every record must be an object".
- Press Run, read the summary and problems table, and download the result.
Limits to know
- Validation is per line, so a record split over several lines is reported as errors.
- Filtering by selected fields can change very large integers.
- Everything runs in your browser.
Frequently asked questions
What is NDJSON? One JSON value per line, also called JSON Lines.
How do I convert NDJSON to a JSON array? Choose "NDJSON → JSON array".
Are blank lines errors? No, they are skipped.
How do I find error lines only? Turn on "List only invalid lines".
Can it handle large files? Yes, they are read in pieces and streamed in the background.