100% local — your data never leaves your browser

NDJSON to JSON — One Array for jq

Turn newline-delimited JSON into a single array. Blank lines are skipped and a bad line is named by its number, so you know where to look.

Instant Private Zero cookies
Indentation

NDJSON input

JSON output

What this tool does

Newline-delimited JSON goes in, one array comes out.

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

That is the whole format: one JSON value per line, no commas between them, no brackets around them. It is what log pipelines write, what bq load and many stream APIs expect, and what jq -c produces.

A bad line is named

{"a": 1}

{oops}
Invalid JSON on line 3

The blank line is skipped without a word — an NDJSON file often ends with one. The malformed line stops the conversion, and the message carries its number, so you can go straight to it. You get no partial array: half the records with nothing to say so is worse than an error.

Long numbers keep their digits

{"id": 12345678901234567890}
[
  {
    "id": 12345678901234567890
  }
]

Past sixteen or so digits, a JavaScript number stops being exact: parse that id as a number and you get a different one back, silently. Both the reading and the writing here keep the literal as it was written, which is what makes a file of Twitter or Discord ids survive the trip.

What it does not do

  • Reorder or deduplicate. The array holds the lines in the order they came, repeats included.
  • Require objects. A line can be any JSON value: 1, "x" and null are valid records, and they come through as such.
  • Split a line. Two values on one line is an error, not two records.

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

What happens if one line is malformed?
The conversion stops and tells you which line: `Invalid JSON on line 3`. Nothing partial is returned — half an array would look like a result, and you would carry the missing records into whatever comes next. Fix the line and convert again.
Do long numeric ids survive?
Yes, digit for digit. A 19-digit id is past what a JavaScript number holds exactly, and a converter that parsed it as a number would hand you a neighbouring value with no warning. The reader and the writer here both keep the literal, so `12345678901234567890` comes out as itself.
What exactly counts as a line?
One whole JSON value. Blank lines are skipped, `\r\n` endings are fine, and a leading byte order mark does not get in the way. Two objects on the same line are not two records, though: that line is reported as invalid, because NDJSON puts one value per line and guessing where to split would be inventing data.

Related converters