deftools.io Developer Tools

NDJSON ↔ JSON Converter

Convert JSON array to NDJSON (JSON Lines) and back. Split JSON arrays into newline-delimited records, or merge JSONL into a single JSON array.

0 lines · 0 chars
0 records · 0 chars

About this tool

NDJSON (Newline-Delimited JSON), also called JSON Lines or .jsonl, is a format where each line is a standalone, valid JSON object — there is no outer array and no commas between records. It is the standard for streaming pipelines: BigQuery table exports, Kafka and Kinesis streams, Elasticsearch bulk APIs, application log files, and tools like jq -c all emit one record per line so you can append, split, and parse files incrementally without loading the whole thing into memory.

This converter goes both ways. JSON Array → NDJSON splits [{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}] into two lines, each a compact JSON object. NDJSON → JSON Array merges the lines back into a single array. Paste either side and the tool auto-detects the direction.

Example: paste the array [{"a":1},{"a":2}] and you get {"a":1} on one line and {"a":2} on the next — ready to stream, pipe through head, or import into BigQuery. Paste those lines back and you get the array again.

FAQ

What is the difference between NDJSON and JSON Lines (.jsonl)?

They are the same format. NDJSON (ndjson.org) and JSON Lines (jsonlines.org) both mean "one JSON object per line, no trailing commas, no outer array". The file extensions .ndjson and .jsonl are interchangeable.

Why use NDJSON instead of a regular JSON array?

A JSON array must be loaded and parsed as a single unit, which breaks on files of millions of records. NDJSON lets you read one line at a time, so tools can stream, append, split, and resume without holding the whole file in memory. That is why BigQuery exports, Kafka consumers, and log shippers use it.

Does the converter handle empty lines or trailing commas?

Yes. Blank lines are skipped during NDJSON → JSON conversion, and a lone comma on its own line is ignored, so output from tools that emit a trailing comma will still parse correctly.

Can I convert a single JSON object (not an array)?

Yes. If you paste a bare object like {"a":1}, JSON Array → NDJSON treats it as one record and outputs a single line. This is handy when you have one event you need to wrap into a streamable line.

More developer tools

Copied!