⚠ Parse Error
Message
Position
Context
Fix hint
NDJSON Format Reference
| Property | Value |
| MIME type | application/x-ndjson |
| Extensions | .ndjson .jsonl .ldjson |
| Delimiter | Newline \n (LF, 0x0A) |
| Each line | Valid, complete JSON value |
| Blank lines | Allowed and ignored by parsers |
| Encoding | UTF-8 (required per RFC 8259) |
| Streamable | Yes — process one line at a time |
| Appendable | Yes — just write a new line to the file |
Who Uses NDJSON?
| System | Why NDJSON / JSONL |
| Elasticsearch | Bulk API requires NDJSON format |
| Google BigQuery | JSONL streaming inserts & exports |
| Apache Kafka | Compact, streaming-friendly records |
| MongoDB | mongoimport uses JSONL natively |
| AWS Kinesis | JSON-per-record data streams |
| Apache Spark | Built-in JSONL reader/writer |
| jq / grep / awk | Process each record independently |
| Log pipelines | Append one line per log event |
Command-Line Conversion Reference
| Tool | JSON → NDJSON command | Notes |
| jq | jq -c '.[]' input.json > out.ndjson | Compact (-c) each array element |
| Python | python3 -c "import sys,json;[print(json.dumps(r)) for r in json.load(sys.stdin)]" < in.json | Works on any OS |
| Node.js | node -e "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).forEach(r=>console.log(JSON.stringify(r)))" | Stream-friendly |
| PHP 8+ | array_map(fn($r)=>print(json_encode($r)."\n"), json_decode(file_get_contents('in.json'),true)); | One-liner CLI |
| NDJSON→JSON | jq -s '.' input.ndjson > output.json | Slurp all lines into array |
| Elasticsearch | curl -X POST "es:9200/_bulk" -H 'Content-Type: application/x-ndjson' --data-binary @data.ndjson | Bulk ingest API |
What Is NDJSON and Why Does It Matter?
NDJSON — Newline Delimited JSON — is a text format where every line is a standalone, valid JSON value. Unlike standard JSON arrays that must be fully downloaded and parsed before any record is accessible, NDJSON allows you to process data line by line, enabling true streaming, constant-memory processing, and effortless file appending.
NDJSON vs Standard JSON: Key Differences
Standard JSON stores records inside a single top-level array, requiring the entire document to be loaded into memory at once. NDJSON gives each record its own line, so systems can begin processing the first record while the rest of the file is still being downloaded or generated.
- Streaming: Read and process records one line at a time — no full file load required.
- Appending: Adding new records is as simple as writing a new line — no restructuring needed.
- Partial reads: grep, awk, and jq can filter specific records without reading the whole file.
- Compression: NDJSON gzips extremely well due to repeated key patterns across lines.
- Error isolation: A corrupted line affects only that record, not the entire dataset.
NDJSON vs JSONL vs LDJSON
All three names refer to the exact same format: one complete JSON value per line. .ndjson is common in Node.js and Elasticsearch communities. .jsonl (JSON Lines) is preferred by Google BigQuery, Python's jsonlines library, and Apache Spark. .ldjson (Line Delimited JSON) appears in some older data pipelines. Choose the extension your target system expects — the content is identical.
When Should You Convert JSON to NDJSON?
- Preparing data for Elasticsearch Bulk API indexing
- Uploading records to Google BigQuery via streaming inserts or batch JSONL load jobs
- Feeding records into Apache Kafka or AWS Kinesis topics
- Importing data into MongoDB using
mongoimport --type json
- Processing large datasets with jq, Python, or Apache Spark
- Building log ingestion pipelines where each event is appended as a new line
- Querying S3 data with Amazon Athena or AWS Glue — the OpenX JSON SerDe needs one object per line
- Reading Amazon Data Firehose output, which writes records back to back (
{…}{…}) unless you add a newline delimiter
Is This Tool Private and Free?
Yes — completely. All JSON to NDJSON conversion logic runs entirely in your browser using JavaScript. No data is ever sent to any server. You can safely convert confidential payloads, API responses, and production data without any privacy concern. The tool also works offline once the page is loaded.
Frequently Asked Questions
What is NDJSON?
NDJSON (Newline Delimited JSON) is a text format where each line is a complete, valid JSON value. It is widely used in data pipelines, streaming systems, and log processing because each record can be read independently.
What is the difference between NDJSON and JSONL?
They are the same format. JSONL (JSON Lines) is the name used by BigQuery and Python libraries; NDJSON is preferred in the Node.js and Elasticsearch ecosystems. File content is identical.
Can I convert a single JSON object to NDJSON?
Yes. A single JSON object outputs as one NDJSON line. A JSON array produces one line per element. Use "Wrap object in array" mode to force a single object into a one-element array output.
How do I convert NDJSON back to JSON?
Use the "NDJSON → JSON" toggle. Paste your NDJSON and click Convert — all lines are wrapped into a valid JSON array. With jq: jq -s '.' file.ndjson
Does Elasticsearch require NDJSON?
Yes — the Elasticsearch Bulk API requires NDJSON. Each document must be preceded by an action metadata line. This tool generates the document lines; you pair them with action metadata.
Is my data sent to your servers?
No. Everything runs in your browser. Nothing is transmitted. The tool is fully private and also works offline after the page has loaded.
Can it convert very large or gzipped files?
Yes. Convert a large file reads the file in pieces, so multi-gigabyte JSON, NDJSON and .gz files (such as Amazon Data Firehose or CloudWatch Logs exports) convert without loading everything into memory. It can expand CloudWatch log events, split the output into parts and gzip it.
How do I query NDJSON with Amazon Athena?
Store one JSON object per line in S3 and create an external table with the OpenX JSON SerDe. The Fields & Athena table tab summarises your fields, flags type conflicts and writes the CREATE EXTERNAL TABLE statement, including mappings for reserved words such as timestamp.