UTILS.
Private by default
}⏎

JSON ⇄ JSON Lines

Convert between a JSON array and NDJSON / JSON Lines.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
output

About this tool

Convert a JSON array to JSON Lines (one compact value per line) and back, entirely in your browser.

Array to lines needs a top-level JSON array; each element becomes one compact line, in order. Other valid JSON shows "input is not a JSON array" and bad syntax shows "invalid JSON". Lines to array trims each line, ignores blank ones, parses each separately and prints one array with two-space indentation. One bad line fails the whole conversion without saying which.

Where the browser supports JSON.rawJSON, numbers keep their exact text, so long integers and 1.0 are not rewritten; elsewhere they go through normal number parsing and may lose precision.

Frequently asked questions

What is JSON Lines?
JSON Lines (also called NDJSON or JSONL) stores one JSON value per line, which is handy for streaming and log files.
Does lines-to-array validate each line?
Yes. Each non-empty line is parsed as JSON; if any line is invalid the tool shows an error message.
What if a line holds an array?
Each line becomes one element, so [1,2] on a line becomes a nested array.
Can I paste a pretty-printed object in lines mode?
No. Every line is parsed on its own, so put each value on one line.

More tools