NDJSON to JSON Converter
Convert NDJSON (JSON Lines) into a pretty JSON array, or split an array back into one object per line, in your browser.
The NDJSON to JSON Converter runs entirely in your browser. The newline-delimited JSON and arrays you paste are parsed on your device and never uploaded to ArrayKit.
Open the JSON Formatter
About NDJSON to JSON
The NDJSON to JSON Converter reshapes newline-delimited JSON — the JSON Lines format used by log streams, API exports, and data pipelines — into a single pretty-printed JSON array you can read or feed to a parser. It reads one JSON value per line, skips blank lines from trailing newlines, and reports how many objects it collected. When a line will not parse, it tells you the exact line number so you can jump straight to the broken record. Flip the mode to turn a JSON array back into NDJSON, emitting one compact object per line for tools like jq, BigQuery, or bulk importers that expect JSON Lines. It suits data engineers, backend developers, and anyone wrangling exports. Every conversion runs on your device, so the records you paste never leave your browser.
Features
- Convert NDJSON / JSON Lines into a single pretty-printed JSON array
- Reverse mode splits a JSON array into one compact object per line
- Reports the object count and total line count for the input
- Flags a bad line by its exact 1-based line number so you can fix it fast
- Skips blank and whitespace-only lines from trailing newlines
- Tolerates CRLF line endings from Windows exports
- Copy the result or download it as a .json or .ndjson file
- Runs entirely in your browser with nothing uploaded
How to use the NDJSON to JSON
- Keep NDJSON → JSON selected for the common direction
- Paste your NDJSON, with one JSON value per line, into the input
- Read the pretty JSON array on the right and check the object count
- Copy or download the result, or switch to JSON → NDJSON to reverse it
Example
Input
{"id":1,"name":"Ada"}
{"id":2,"name":"Linus"}
Output
[
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Linus" }
]
Two NDJSON lines become a two-element pretty JSON array.
Common errors & troubleshooting
- Conversion fails with 'Line 5: invalid JSON'. — Open line 5 of the input — each line must be one complete JSON value. A trailing comma, an unquoted key, or a value split across two lines will break that record.
- You pasted a JSON array but chose NDJSON → JSON. — A pretty array spans many lines, so most lines are not valid on their own. Switch to JSON → NDJSON to flatten the array into one object per line instead.
- JSON → NDJSON reports 'Expected a JSON array.' — NDJSON is produced from array items, so wrap your objects in [ ... ]. A single object or a bare value cannot be split into lines.
- The output array is missing the last record. — Check the final line ends cleanly. Blank trailing lines are skipped, but a truncated last record silently produces a parse error at that line number.
Frequently asked questions
- What is the difference between NDJSON and a JSON array?
- NDJSON (also called JSON Lines) puts one independent JSON value on each line with no surrounding brackets or commas, so it streams record by record. A JSON array wraps all the values in [ ] separated by commas and must be parsed as one document. This tool converts between the two.
- How do I convert JSON Lines (.jsonl) to a JSON array?
- Paste the contents of your .jsonl file into the input with NDJSON → JSON selected. Each line is parsed as one value and collected into a pretty-printed array, and the tool shows how many objects it read.
- Can I turn a JSON array back into NDJSON?
- Yes. Switch to JSON → NDJSON and paste a JSON array. Each array element is written on its own line as a compact single-line JSON value — the JSON Lines format expected by jq, BigQuery, and bulk importers.
- Why does the converter report a specific line number?
- NDJSON is line-oriented, so a single malformed record only breaks its own line. The tool stops at the first line it cannot parse and reports that 1-based line number, letting you fix the offending record instead of hunting through the whole file.
- Does the tool skip blank lines in NDJSON?
- Yes. Blank and whitespace-only lines — common from a trailing newline at the end of a file — are ignored, so they do not appear as null entries or trigger a parse error. Only non-empty lines count toward the object total.
- Is my NDJSON data uploaded when I convert it?
- No. The NDJSON to JSON conversion runs entirely in your browser using the built-in JSON parser. The records you paste never leave your device and nothing is sent to ArrayKit.
Related tools
- JSON Formatter — Beautify, minify and validate JSON with error locations.
- JSON to CSV — Convert an array of flat JSON objects to CSV.
- JSON Flatten / Unflatten — Flatten nested JSON to dot-notation keys, or unflatten it back.
- JSON Diff — Compare two JSON documents and see a structural, key-order-independent diff.
- Sort JSON Keys — Recursively sort JSON object keys alphabetically, with pretty-print and reverse options.
- YAML ↔ JSON — Convert YAML to JSON and back.
All ArrayKit tools