JSON Lines Formatter

Runs in browser JSON & Data

Split a JSON array into one JSON document per line, or join JSON Lines back into a pretty-printed array — the format used by logs, streaming APIs and bulk imports.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

What is JSON Lines?

JSON Lines (also NDJSON) is a text format in which each line is one complete JSON value, usually an object, separated by newlines with no enclosing array. Because a reader can process one line at a time, it suits logs, exports and streaming APIs where a single JSON array would have to be held in memory whole; the price is that the file as a whole is not valid JSON and each line must be parsed separately.

Read the guide: What is JSON?

How to use JSON Lines Formatter

  1. Paste either a JSON array or JSON Lines content.
  2. Leave direction on Auto-detect or pick one explicitly.
  3. Copy or download the converted output.

JSON Lines Formatter features

  • Splits a JSON array into one compact JSON document per line
  • Joins JSON Lines back into a pretty-printed array
  • Auto-detects the direction, or force it explicitly
  • Reports the first invalid line with its number when joining
  • Skips blank lines safely
  • Downloads as .jsonl or .json

JSON Lines Formatter example

Array to JSON Lines

Input:

[{"id":1,"level":"info"},{"id":2,"level":"error"}]

Output:

{"id":1,"level":"info"}
{"id":2,"level":"error"}

Frequently asked questions about JSON Lines Formatter

What is JSON Lines / NDJSON?

A text format with exactly one JSON value per line, separated by newlines. It streams well and is used by log shippers, BigQuery, Elasticsearch bulk APIs and many data pipelines.

How does auto-detect decide the direction?

If the first lines each parse as standalone JSON values, the input is treated as JSON Lines and joined into an array; otherwise it is parsed as a JSON document and split into lines.

What if my array contains nested arrays or objects?

Each top-level item is written on its own line as compact JSON, regardless of how deeply nested it is.

Are blank lines a problem?

Blank lines are skipped when joining. When splitting, the output never contains blank lines, so it is safe for strict NDJSON consumers.

References