JSON to JSON Lines
Convert JSON arrays to JSON Lines and back.
JSON to JSON Lines Converter (JSONL / NDJSON)
This converter turns a JSON array into JSON Lines — one compact JSON record per line — and back. JSON Lines, also known as JSONL or NDJSON (newline-delimited JSON), is the standard format for logs, streaming data, bulk imports, and machine-learning datasets.
JSON array vs. JSON Lines
A JSON array must be read completely before it can be parsed, and a single missing bracket invalidates the whole file. JSON Lines puts every record on its own line:
{"id":1,"name":"Ada"}{"id":2,"name":"Alan"}
Each line is valid JSON on its own, so programs can process files of any size line by line, append new records without rewriting the file, split work across machines, and skip a corrupted line without losing the rest.
Two directions
- JSON → JSON Lines – each array item is minified onto a single line. A lone object becomes one line.
- JSON Lines → JSON – every non-empty line is parsed and collected into a JSON array, pretty-printed or minified. Invalid lines are reported with their line number.
Use the swap button to send the output back as input and switch direction.
Common uses
- Preparing fine-tuning and batch files for LLM APIs, which expect
.jsonl. - Loading data into BigQuery, Snowflake, or Elasticsearch's bulk API.
- Reading structured logs from tools that write one JSON event per line.
- Inspecting a JSONL export by turning it into a regular array you can view in the JSON Viewer.
Related tools
Minify a single document with the JSON Minifier or convert records to spreadsheet format with JSON to CSV.
Frequently Asked Questions
What is JSON Lines (JSONL / NDJSON)?
A text format with one complete, minified JSON value per line, separated by newlines. It's also called newline-delimited JSON (NDJSON). Unlike a JSON array, it can be written and read one record at a time, which makes it ideal for logs, streams, and very large datasets.
Where is JSON Lines used?
In log pipelines (Elasticsearch bulk API, Loki, many loggers), data warehouses (BigQuery, Snowflake, Redshift imports), machine-learning datasets and fine-tuning files for LLM APIs, and streaming APIs that send one event per line.
What happens if one line is invalid?
The converter stops and tells you the line number and the problem, so you can find the bad record in a large file. Blank lines are ignored.
What if my JSON isn't an array?
A single object becomes a one-line JSON Lines file. For an array, each item — object, array, or value — becomes its own line.