NDJSON / JSON Lines to JSON
Paste newline-delimited JSON and get one clean JSON array, or flatten an array back to one object per line.
Direction
Converted live as you type. Nothing leaves your browser.
Options
How to convert NDJSON to a JSON array online
Paste your lines
Paste newline-delimited JSON, with one record per line, into the input box.
Pick a direction
Keep Lines to array to build a single JSON array, or switch to Array to lines to flatten a JSON array back into one object per line.
Handle blank lines
Choose whether empty lines are skipped or reported as an error, and the output updates the moment you change anything.
Copy the result
Copy the pretty-printed JSON array to your clipboard or download it as a file.
Why use this tool
Both directions
Turn one record per line into a single pretty-printed JSON array, or flatten a JSON array back into newline-delimited records.
Exact line numbers on errors
A malformed record is reported with the specific line number it appears on, so you can fix the one line that broke the parse.
Blank line control
Empty lines can be skipped silently or flagged as an error, and a trailing newline at the end of the file is always ignored.
Compact or spaced lines
When flattening to lines, keep each record compact on one line, or add spacing after keys and commas for easier reading.
Handles large inputs
Records are read one line at a time, so files with thousands of rows convert without choking the page.
Runs entirely in your browser
Everything happens on your device. Nothing is uploaded, stored, or logged.
About this tool
This tool converts between NDJSON, also called JSON Lines or JSONL, and a regular JSON array. In the forward direction it reads each non-empty line as an independent JSON value and collects them into one pretty-printed array. In reverse it takes a JSON array and writes each element on its own line, which is the format log pipelines, data exports, and streaming APIs expect. The output regenerates the moment you edit the input or change an option, so there is no convert button to press.
NDJSON is common because each line stands alone, which makes files easy to append to and stream. That also means a single bad line can break a naive parse, so this converter reports the exact line number of the first malformed record instead of a vague failure. Blank lines can be skipped or treated as an error, and a final trailing newline is ignored so a well-formed file never trips the blank-line check.
Everything runs in your browser and your data never leaves your device, which matters when the records contain user or event data. To pretty-print or validate the array you get back, use the JSON formatter, and to reshape tabular exports the CSV to JSON converter continues the chain.
Frequently asked questions
- What is the difference between NDJSON, JSONL, and JSON?
- NDJSON and JSON Lines (JSONL) are the same format: one complete JSON value per line, with no surrounding brackets or commas between lines. A JSON array wraps those same values in square brackets separated by commas. This tool converts freely between the two.
- How does the converter work?
- Paste your text and pick a direction. Going from lines to an array, each non-empty line is read on its own and collected into a pretty-printed JSON array. Going the other way, each element of a JSON array is written on its own line. The result updates live as you type.
- What happens if one line is invalid?
- The converter stops at the first malformed record and tells you the exact line number, along with the reason it could not be read, so you can fix that single line rather than hunting through the whole file.
- How are blank lines and trailing newlines handled?
- You choose whether empty lines are skipped or reported as an error. A single trailing newline at the very end of the file is always ignored, so a normal file that ends with a line break is never flagged as having a blank line.
- Is my data uploaded anywhere?
- No. Everything runs in your browser. Your data never leaves your device, is never sent to a server, and is not stored or logged.
Related tools
JSON Formatter & Validator
Pretty-print, minify, or explore JSON as a collapsible tree, with syntax errors shown inline.
CSV to JSON
Paste CSV and get a clean JSON array of objects, with header detection and automatic number and boolean typing.
JSON to YAML
Convert JSON to YAML and YAML back to JSON, in both directions, with your choice of indentation.
Angle Converter
Convert an angle between degrees, radians, gradians, turns, arcminutes and arcseconds, with a degrees-minutes-seconds breakdown.
Area Converter
Convert area between metric and imperial units instantly.
Binary to Decimal Converter
Convert a binary number to its decimal value, with hexadecimal and octal readouts.