Convert NDJSON to a JSON array

Turn one-JSON-value-per-line input into an indented JSON array.

freeworks offlinenothing uploaded
ToolNDJSON Parser
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Input is split at newline boundaries, each non-empty line is parsed independently, and successful values are emitted in one array. Empty and malformed lines can be skipped or reported using the selected options.

  • Skipping empty lines matches common JSON Lines streams.
  • Two-space indentation keeps the array readable without changing values.

Worked example

User records from NDJSON log lines
Parse newline-delimited JSON lines into a JSON array
Input
											{"id":1,"name":"Alice"}
{"id":2,"name":"Bob"}
										
Output
												ID  Name
--  -----
1   Alice
2   Bob
											

When to use this

Streaming logs, BigQuery JSONL imports, and Unix event pipelines use newline-delimited records.

Edge cases

  • A pretty-printed multi-line object is not one NDJSON record and fails line-by-line parsing.
  • An empty line is ignored by default but becomes an error when skipping is disabled.
  • A malformed record stops processing unless invalid-line skipping records its line number.

References