100% local — your data never leaves your browser

JSON to NDJSON — One Record per Line

Turn a JSON array into newline-delimited JSON. One document per line, minified, ready for bq load, a log pipeline or a streaming API.

Instant Private Zero cookies

JSON input

NDJSON output

What this tool does

A JSON array becomes one JSON document per line.

[
  { "id": 1, "name": "Ada" },
  { "id": 2, "name": "Grace" }
]
{"id":1,"name":"Ada"}
{"id":2,"name":"Grace"}

Each line is minified, and that is not a stylistic choice: a pretty-printed document spans several lines, and in NDJSON a line break means next record. Indentation and the format are mutually exclusive.

The root has to be an array

The array is the list of records. An object at the root is one document, and splitting it into lines would mean deciding that its keys are records — a guess this tool will not make. The conversion stops instead.

The items themselves are unconstrained: null, 42 and "text" are valid JSON documents and therefore valid NDJSON lines. Records are usually objects, but nothing here requires it.

Long integers keep their digits

[{ "id": 12345678901234567890 }]

comes out with all twenty digits. A converter that parses through a JavaScript number writes 12345678901234567000 instead, silently — the value changes and the file still looks perfectly well-formed.

This one used to do exactly that. It was found while writing this page and fixed; the identifier now survives the round trip through NDJSON and back.

An empty array gives an empty file

[] produces no output at all, and that is the correct answer: NDJSON has no way to write “zero records” other than an empty file. It does mean an empty result and an empty input look alike — worth knowing before you conclude that nothing happened.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Why must the root be an array?
Because NDJSON is a list of records and the array is the list. An object at the root is a single document, and there is no honest way to decide whether it is one record or a collection to be split apart. It is refused rather than guessed at.
What happens to a newline inside one of my strings?
It is written `\n`, as JSON requires, so it stays inside the line. That matters more here than elsewhere: in NDJSON the line break is the record separator, and a real newline in the middle of a document would split one record into two unparsable halves.
My file is a single array of one million rows. Is that a problem?
It is the case NDJSON exists for, but the conversion still reads the whole array into memory first, because the input is one JSON document and a document has to be complete to be parsed. For files large enough that this hurts, a streaming tool such as `jq -c ".[]"` is the better instrument.

Related converters