JSONL to JSON Array Converter

Convert JSON Lines (NDJSON) to a pretty JSON array and back as you type — a bad line is flagged by its exact line number.

You can also drop a .jsonl, .ndjson, .json or .txt file onto this box.

Open file and a drop put a file of up to 10.0 MB in the box. Convert a large file…, or a bigger file dropped on the box, takes up to 200.0 MB: it is read as UTF-8 a piece at a time, only its first records are shown here, and the whole array is a download.

One JSON value per line, and back

JSON Lines (also called NDJSON, newline-delimited JSON) stores one JSON value per line, which is ideal for logs and streaming but awkward to read or paste into code that expects a single array. This converter turns a JSONL block into a neatly indented JSON array, and turns a JSON array back into JSONL where each element sits on its own line. Both boxes are linked, so editing either side instantly rebuilds the other. Blank lines are ignored, and every value type is supported: objects, arrays, numbers, strings, booleans, and null. Some APIs and bulk endpoints want the records inside an object rather than a bare array: type a key into Wrap the array in an object under this key and the JSON side becomes {"records": [ … ]}; an object like that pasted into the JSON box is read back into lines, and its key goes into the box. A file too big for the box goes through Convert a large file… instead: it is read a piece at a time and never enters either box, the page shows its counts and first records, and the whole array is a download.

When to use each direction

Go from JSONL to a JSON array when you have exported log lines, a database dump, or an API stream and need one valid array to load with JSON.parse or paste into a config. Go from a JSON array to JSONL when a tool such as BigQuery, jq, or a bulk import endpoint expects newline-delimited records instead of a wrapping array. If a line cannot be parsed, the tool tells you exactly which line number is at fault so you can fix it quickly.

Frequently asked questions

What is the difference between JSONL and a JSON array?

A JSON array wraps every item in a single [ ... ] structure separated by commas, while JSONL (NDJSON) writes each item as its own JSON value on a separate line with no surrounding brackets or commas. JSONL is easier to append to and stream line by line; a JSON array is a single parseable document.

What happens to blank lines and invalid lines?

Blank or whitespace-only lines are skipped, so trailing newlines do not create empty entries. If a non-empty line is not valid JSON, the tool stops and shows the exact 1-based line number so you can locate and fix the problem.

Can I choose how the JSON array is laid out, or drop the file on the page?

Yes. The output can be indented by two or four spaces or written on one compact line, and a JSONL file can be dropped straight onto the input box.

Does it tell me how many records it converted?

Yes. Each JSONL → JSON conversion prints a line under the result saying how many records came out of how many non-blank lines, so an export can be checked against the count you expected without counting brackets. With Skip invalid lines ticked, the same line also says how many lines were skipped as invalid and names them by line number; past the first handful it counts the rest instead of listing them. With it off, the first bad line stops the conversion and nothing is counted.

Can the JSON be wrapped in an object, like { "records": [ … ] }?

Yes. Type a key into Wrap the array in an object under this key and the array is written under it, in whichever indent you chose; leave the box empty for the bare array. It works backwards as well: paste an object that holds one array under a single key into the JSON box and it is turned back into lines, with its key put into the wrap box, so the two boxes stay each other’s inverse. Any other object is refused, and the message names the wrapped shape it accepts.

Can it convert a file bigger than the box takes?

Yes. Choose it with Convert a large file…, or drop it on the box, and it is read as UTF-8 a piece at a time without entering either box, in the indent, wrap key and Skip invalid lines setting chosen at the time. The page then says how many records came out of how many lines, shows the first records as a preview, and offers the whole array as a .json download named after the file. A file in another encoding is refused rather than guessed, and the largest size it takes is written under the button.