NDJSON, also called JSON Lines, is the format many logging systems, streaming APIs and command line tools like jq actually produce, since writing one complete JSON value per line lets a consumer process the data as it arrives without waiting for a closing bracket that might never come. That property makes it excellent for streaming, but it also means a plain NDJSON file is not valid JSON on its own and cannot be loaded directly with a normal JSON.parse call, which expects exactly one value in the whole document.
The conversion happens entirely in your browser, so a log export or an API response captured as NDJSON, which is very often full of real user activity or production data, never has to leave your device to become an ordinary JSON array. Each line is parsed independently, so one malformed line is reported precisely rather than silently corrupting the whole result.
One document, not a stream of them
Reaching for an ndjson to json converter makes sense the moment you need to load newline delimited JSON output into a tool or a piece of code that expects a single JSON document, such as pasting it into a JSON formatter, feeding it to JSON.parse in a script, or attaching it to an API request body that must be one JSON array rather than a stream of individual objects.
Keep the data as NDJSON when it is still being consumed the way it was produced, line by line, such as being piped through a command line tool built around streaming JSON, or being appended to continuously by a logging system where a genuine end of file marker never really exists.
- Convert to JSON to paste NDJSON output into a formatter, validator or diff tool that expects one document.
- Convert to JSON to attach line delimited log output to an API request body as a single array.
- Convert to JSON before loading the data with JSON.parse in ordinary application code.
- Keep NDJSON when a tool downstream is specifically built to stream and process it line by line.
What newline delimited json actually looks like
A valid NDJSON document places exactly one complete JSON value on each line, with a newline character marking the end of that value rather than a comma, and no enclosing square brackets around the whole file at all. A three line log export might read {"level":"info","msg":"start"} on one line, {"level":"error","msg":"timeout"} on the next, and so on, each one independently valid JSON but with nothing tying the file together as one document until this converter combines them.
Blank lines between entries, which show up often in files that have been manually edited or concatenated from multiple sources, are skipped automatically rather than treated as an error, since a stray empty line carries no data of its own to lose.
Converting jsonl to json when a line fails to parse
Because every line is parsed on its own with JSON.parse rather than the whole file being parsed at once, a single malformed line is reported with its exact line number and the parser's own description of what went wrong, rather than the entire conversion failing with one vague message. This makes tracking down a truncated line at the end of a log export, a common cause of failure when a process is killed mid write, straightforward instead of requiring a manual scan of every line.
This line by line approach is also what makes jsonl to json conversion resilient to a file where most lines are perfectly valid and only one or two near the end got cut off, since you get a precise pointer to the broken line rather than losing visibility into the hundreds of good ones that came before it.
Why NDJSON exists alongside a plain json lines to array need
A tool that streams data, appending one new line as each record becomes available, cannot wait for a closing square bracket the way a single JSON array requires, since the array is not known to be complete until the entire stream ends. Writing one independent JSON value per line lets a consumer start processing records immediately as they arrive, which is exactly why logging systems, Kafka style event streams and command line tools built for streaming all gravitate toward this format rather than one big array.
The tradeoff is that NDJSON on its own is not valid JSON, so any tool expecting a normal JSON document, from a JSON schema validator to a REST API body, needs the file combined into a proper array first, which is precisely the json lines to array step this converter performs.
Inside the ndjson to json converter: split on newlines, parse each line alone
The input is split on newline characters, blank lines are discarded, and each remaining line is parsed independently with JSON.parse. Every successfully parsed value becomes one element of the output array, in the same order the lines appeared in the source file, and the finished array is serialised with your chosen indentation.
Because this runs as plain JavaScript in your browser tab, there is no upload step and no server side queue involved, so a log export with tens of thousands of lines converts in well under a second on ordinary hardware, limited only by the memory available to the browser tab itself.
How to convert NDJSON to JSON
- 1
Add your NDJSON
Paste newline delimited JSON into the box, or drop a .ndjson or .jsonl file. Nothing leaves your device.
- 2
Choose the JSON indent
Pick 2 or 4 space indentation for the resulting array, matching your project's usual style.
- 3
Convert
Press convert. A malformed line is reported with its exact line number instead of a vague failure.
- 4
Copy or download
Once conversion succeeds, copy the JSON array to your clipboard or download it as a .json file.
Related tools worth bookmarking
Sources and further reading
- JSON.org: Introducing JSONThe official description of the JSON value format each line of an NDJSON file must be.json.org
- RFC 8259: The JSON Data Interchange FormatThe IETF standard defining a single JSON value, which is what every line of NDJSON must satisfy.rfc-editor.org
- MDN: JSON.parseThe browser API used to parse each line of the file independently before it joins the array.developer.mozilla.org
Frequently asked questions
Common questions about the ndjson to json converter.
Yes. This ndjson to json converter parses and pushes each line onto the output array in the exact sequence it was read from the source file, with no reordering or sorting applied at any point, so a log file's chronological order is preserved exactly in the resulting JSON array.
NDJSON and JSON Lines, often abbreviated JSONL, refer to the same idea: one complete JSON value written on each line of a file, with no enclosing array or commas between entries. The two names are used somewhat interchangeably across different tools and ecosystems, and this converter treats them identically.
The tool reports the exact line number of the first broken line along with the parser's own description of the problem, rather than failing the entire conversion with a vague error. Fixing that specific line and converting again resolves it without needing to scan every other line by hand.
No. Blank lines are skipped automatically rather than treated as an error, since an empty line carries no JSON value of its own to lose. This is common in files that have been manually edited or concatenated together from more than one source.
Yes. The output is a standard JSON array, which JSON.parse in any JavaScript environment reads directly into a native array of objects, ready to filter, map or otherwise process with ordinary array methods.
No. This ndjson to json converter splits the file on newline characters and hands each resulting line to JSON.parse independently, all inside your browser tab, so a log export containing real user activity never leaves your device while it is being combined into a single array.