Skip to content
{ }JSON Formatter

JSON Lines (NDJSON) to JSON

Wrap newline-delimited JSON records back into a normal, pretty-printed JSON array — blank lines skipped, the exact line reported if a record is malformed.

Input
Output
Paste input and press To JSON array.

Line-delimited records into an array

A .jsonl or .ndjson file — a log dump, a BigQuery export, a dataset — is a stream of JSON records, one per line, with no wrapping array. To work with it in most code or tools you want a normal JSON array. This tool parses each non-blank line and collects the records into a pretty-printed array. If a line isn't valid JSON, you get its exact line number instead of a vague failure, so you can fix the one bad record.

What it tolerates

  • Blank lines between records are skipped (trailing newlines are common).
  • Any JSON value per line — objects, arrays, numbers or strings.
  • Surrounding whitespace on a line is trimmed before parsing.

After the round-trip

Once you have an array, the rest of the toolset opens up: explore it in the tree viewer or table viewer, extract fields with the JSONPath filter, or convert it to CSV. Going back to line-delimited form is JSON to JSON Lines.

Frequently asked questions

What happens to blank lines?

They are skipped. NDJSON files commonly end with a trailing newline, and some are padded with blank lines between records; neither causes an error.

What if one line is malformed?

Conversion stops and reports the exact line number and the JSON error on it — for example "Line 4 is not valid JSON: Unexpected token…". Fix that record and run again.

Does each line have to be an object?

No — any JSON value per line works (numbers, strings, arrays), and each becomes one array element. Object-per-line is simply the most common case.

Can it handle very large files?

Parsing happens in your browser, so it scales with your machine rather than a server limit. Multi-megabyte NDJSON converts quickly; for gigabyte log files, a streaming CLI tool is the better fit.