JSON to NDJSON Converter
Turn an array into one JSON value per line for a log or a stream, and turn those lines back into an array.
JSON
Syntax colouring is off for this document because recolouring something this large on every keystroke would slow typing down. Every tool still works normally.
NDJSON
Syntax colouring is off for this document because recolouring something this large on every keystroke would slow typing down. Every tool still works normally.
The result appears here.
Batch validation
A report on the JSONL in the left pane, whichever direction is selected. Nothing here changes the document.
Runs entirely in your browser. Nothing you paste is uploaded, and you can confirm that in your browser Network tab.
About this tool
NDJSON is one JSON value per line, and that is the whole format. It exists because a reader can handle a line and forget it, which is what makes a log file or a large export streamable when a single enormous array is not. Any JSON value is allowed on a line, not only an object, and no line is indented, because a line break inside a value would end the record. This tool skips a completely blank line rather than failing on it, since almost every file ends with a newline, and it reports a line that does not parse by the number it has in your file rather than by a position in some rewritten document. That skip is the default; the Blank lines option can treat a blank line as a failure instead. Keep valid lines changes what a bad line does to the rest of the file: instead of stopping the conversion, every line is judged on its own, the lines that parse build the result, and the lines that do not are listed with their line number and reason. Both directions go through the token stream, so a twenty digit integer comes back with all twenty digits. Batch validation, below the converter, is a separate report rather than a conversion: it checks every record on its own against an optional JSON Schema, checks for required fields, finds duplicate values in one chosen ID field, and compares every record's keys and types against whichever shape most records actually have, without changing the document.
How to use
- Choose a direction, then paste your document into the left pane or load the sample.
- Press Convert. Going to NDJSON needs an array, since that is the JSON shape that is a sequence of values.
- Copy the result or download it. Any line that does not parse is reported with its line number.