JSON array to JSON Lines converter

Many data tools read one record per line instead of one big array, and this tool prepares that format.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter json.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Each array item is written as compact JSON with no spaces or inner line breaks, and items are separated by a newline character. Key order and number text stay as in the input.

Example

Result: JSON Lines: {"id":1,"name":"Ali","city":"Riyadh"} {"id":2,"name":"Sara","city":"Jeddah"} {"id":3,"name":"Omar","city":"Dubai"}; Lines: 3.

[
  {"id": 1, "name": "Ali", "city": "Riyadh"},
  {"id": 2, "name": "Sara", "city": "Jeddah"},
  {"id": 3, "name": "Omar", "city": "Dubai"}
]
{"id":1,"name":"Ali","city":"Riyadh"}
{"id":2,"name":"Sara","city":"Jeddah"}
{"id":3,"name":"Omar","city":"Dubai"}

Limits and caveats

  • The input must be an array at the top level.
  • Line breaks inside strings are written as \n so they never split a line.

Questions about this tool

What is the difference between JSON Lines and NDJSON?

In practice they are the same format: one valid JSON value per line separated by newlines, usually saved as .jsonl or .ndjson.

Do the items have to be objects?

No, any JSON value can be a line, though most tools expect one object per line.

Why is JSON Lines used for large files?

A program can read one line at a time without loading the whole file, and new records can be appended at the end.