JSON to JSON Lines Converter

Paste a JSON array and get newline-delimited JSON with one minified record per line. The array is split locally, so exported data never leaves your computer.

JSON → JSON Lines

Input

Settings

History

Load from URL

What JSON Lines is for

JSON Lines (also called NDJSON or JSONL) stores one JSON value per line instead of one big array. Streaming tools love it because they can read, append and split a file line by line without parsing the whole thing. You typically need it when:

  • Loading data into BigQuery, Snowflake or DuckDB, which accept newline-delimited JSON imports.
  • Preparing an Elasticsearch / OpenSearch bulk body or an OpenAI-style fine-tuning file (.jsonl).
  • Appending events to a log file that jq -c, grep and split can process.

The JSON Lines vs JSON guide explains when each layout is the better choice.

How the array is split

The converter parses your JSON once, then writes each top-level array element on its own line in compact form, with no spaces after colons or commas:

  • Objects, arrays, strings, numbers, booleans and null are all valid records, so an array of mixed values works too.
  • Nested objects and arrays stay inside their record; only the outermost array is unwrapped.
  • Line breaks inside strings are written as \n escapes, so a record can never spill onto a second line.
  • Non-ASCII text such as é or emoji is kept as-is in UTF-8, not escaped.
  • Numbers keep their source digits, so 64-bit IDs are not rounded.
  • Key order inside each record is preserved.

If the input is a single object rather than an array, it becomes a one-line file containing that object, and an info message points this out — useful when you meant to unwrap a property such as {"items": [...]} first.

Things to check before you import

  • Wrapped arrays. Many APIs return {"data": [...]}. Convert only the inner array; otherwise you get one giant record. Extract it with a JSONPath or jq query in the JSON formatter first.
  • Duplicate keys are reported as warnings; the later value is the one written.
  • Trailing newline. The output ends with a newline after the last record, which is what most loaders expect.
  • Size. Very large arrays work, but the whole input is held in memory in the tab; for multi-gigabyte exports use a command-line tool such as jq -c '.[]'.

Nothing is lost in this direction: every value is preserved exactly, only whitespace changes.

Options

There are no conversion options; JSON Lines has exactly one layout. To reverse the process, use JSON Lines to JSON, and to pretty-print or validate an existing .jsonl file record by record, use the NDJSON formatter. As with every PasteKit tool, the conversion is computed by code running in your browser.

Examples

Rows for a BigQuery load job

Each object becomes one compact line, and the accented name stays readable rather than escaped.

Input
[
  { "id": 1, "name": "Aisha Tan", "city": "Singapore", "joined": "2024-03-11", "balance": 1520.5 },
  { "id": 2, "name": "Ben Okafor", "city": "Lagos", "joined": "2023-11-02", "balance": 88 },
  { "id": 3, "name": "Chloé Martin", "city": "Paris", "joined": "2025-01-20", "balance": -12.75 }
]
Output
{"id":1,"name":"Aisha Tan","city":"Singapore","joined":"2024-03-11","balance":1520.5}
{"id":2,"name":"Ben Okafor","city":"Lagos","joined":"2023-11-02","balance":88}
{"id":3,"name":"Chloé Martin","city":"Paris","joined":"2025-01-20","balance":-12.75}
Open this example in the tool

Events with nested data

Nested ctx objects stay inside their records, and the embedded line break remains a \n escape so each event is exactly one line.

Input
[
  { "ts": "2026-09-14T08:21:05Z", "level": "error", "msg": "payment failed\nretrying", "ctx": { "order": "ord_8f2k1", "attempt": 2 } },
  { "ts": "2026-09-14T08:21:09Z", "level": "info", "msg": "payment captured", "ctx": { "order": "ord_8f2k1", "attempt": 3 } }
]
Output
{"ts":"2026-09-14T08:21:05Z","level":"error","msg":"payment failed\nretrying","ctx":{"order":"ord_8f2k1","attempt":2}}
{"ts":"2026-09-14T08:21:09Z","level":"info","msg":"payment captured","ctx":{"order":"ord_8f2k1","attempt":3}}
Open this example in the tool

Common errors and how to fix them

ErrorCauseFix
The input is not an array, so it became a single JSON Lines recordAn info note: the top-level JSON value is an object, often an API envelope like {“data”: […]}.Convert the inner array instead, so each element gets its own line.
Object keys must be in double quotes: found …
Explained
The input uses unquoted keys, as JavaScript object literals do.Quote every key, or run the text through the JSON5 to JSON converter first.
Unexpected end of input
Explained
The JSON was cut off, usually by copying only part of a large response.Copy the complete document, including the closing ] of the array.

Frequently asked questions

Is NDJSON the same as JSONL?

Yes, in practice. NDJSON (newline-delimited JSON) and JSON Lines describe the same layout, and .jsonl is the usual file extension.

Can a record span several lines?

Not in JSON Lines. The converter always writes each record compactly on one line and escapes line breaks inside strings.

What if my array contains numbers or strings rather than objects?

Each element still becomes one line. JSON Lines allows any JSON value per line, though most loaders expect objects.

Does the conversion change any values?

No. Only whitespace is removed; strings, numbers and key order are written exactly as they were.

Related tools