JSON to NDJSON Converter
Convert JSON arrays to NDJSON (Newline Delimited JSON) format and back. Each object becomes a single line for streaming and log processing.
NDJSON Output
About NDJSON (Newline Delimited JSON)
NDJSON (also known as JSON Lines or JSONL) is a convenient format for storing structured data where each line is a valid JSON object. Unlike a regular JSON array, NDJSON files can be streamed and processed line-by-line without loading the entire file into memory. This makes it ideal for log files, large data pipelines, and streaming APIs. This converter handles both directions: split a JSON array into individual lines, or merge NDJSON lines back into a JSON array.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Converting a JSON array into the line-delimited form a streaming consumer expects.
- Producing a file a log pipeline or a bulk-import API can read record by record.
- Splitting a large array so it can be processed without loading all of it.
- Converting back to an array for a tool that needs the whole document.
- Producing a fixture in the format a streaming parser is tested against.
Frequently Asked Questions
- What is NDJSON and why does it exist?
- Newline-delimited JSON: one complete JSON value per line, no wrapping array and no commas between records. It exists so a consumer can process a 40 GB file one line at a time — a JSON array has to be parsed as a single value, which means holding all of it in memory.
- Is NDJSON the same as JSON Lines or JSONL?
- Effectively yes — the three names describe the same layout and the differences between their specs are pedantic. JSON Lines additionally requires UTF-8 and `\n` rather than `\r\n`, which is worth knowing when a file produced on Windows fails in a strict reader.
- Can a record span multiple lines?
- No, and that constraint is what makes the format work — a line break IS the record delimiter, so every object must be serialised compactly. That is why converting to NDJSON strips the pretty-printing, and why running a formatter over an NDJSON file destroys it.
- What uses this format?
- Elasticsearch's bulk API, BigQuery and Snowflake loaders, Kubernetes and Docker log output, and most streaming HTTP APIs. When a system asks for "JSON lines" or one-object-per-line, this is what it means.
- Why must the input be an array?
- Because NDJSON is a sequence of records and an array is the only JSON shape that carries one. A top-level object is a single value with no obvious way to split it — you would have to decide whether its keys or its values are the records, and guessing wrong is worse than refusing.
Common errors and gotchas
- Leaving the enclosing brackets or the commas, which makes it neither valid JSON nor valid NDJSON.
- Pretty-printing the records, which puts newlines inside them and breaks the one-record-per-line contract.
- Converting back to an array and forgetting the commas, which yields a document that is neither format.
- Assuming every record has the same shape, when the format permits and often carries heterogeneity.
- Converting a nested array of arrays, where the records are not objects and the format has no meaning.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.