JSON Lines Converter

Paste newline-delimited JSON and get a normal JSON array, or paste an array and get one compact value per line. The line number is reported for any line that is not valid JSON.

Direction

Worked examples

Lines to array

{"id":1} {"id":2}

[{"id":1},{"id":2}]

Two lines became a two item list.

Array to lines

[{"a":1},{"b":[1,2]}]

{"a":1} {"b":[1,2]}

One compact value per line.

About JSON Lines Converter

JSON Lines, also called newline-delimited JSON or JSONL, stores one complete JSON value on each line. It is the usual format for logs, exports from data stores and machine learning data, because you can append to a file, stream it and handle it one line at a time without loading everything.

This converter turns JSON Lines into an ordinary JSON array, which most viewers and editors expect, and turns an array back into one compact value per line. Blank lines are skipped. If a line contains a mistake you are told which line it is and what is wrong, which is the information you need when a large export refuses to load.

How to use JSON Lines Converter

  1. Choose JSON Lines to array, or array to JSON Lines.
  2. Paste the data.
  3. Choose the indent for array output.
  4. Copy the result, or fix the line named in the message.

Common uses

  • Opening a log export in a JSON viewer
  • Preparing an array for an import that wants one record per line
  • Finding the broken line in a large data file
  • Sharing a small sample of a line-based dataset

Frequently asked questions

What makes a valid JSON Lines file?

Every line is a complete JSON value, usually an object, and lines are separated by line breaks. A value cannot be split over several lines.

Are blank lines allowed?

They are skipped here. Strictly, the format does not expect them, but exports often end with one.

Why does the array to lines direction need a list?

Each item of the list becomes a line. A single object has no items to split, so wrap it in square brackets first.

Does it change the values?

No. Each value is written back as compact JSON with the same content.

What does the indent apply to?

Only the array output. JSON Lines output is always compact because each value must stay on one line.