JSON vs NDJSON
JSON and NDJSON (Newline-Delimited JSON) both use JSON syntax, but they have very different data models. A JSON file holds one value — typically an array of objects. An NDJSON file holds one independent JSON object per line. That one structural difference determines which format is appropriate for streaming, logging, and large-dataset scenarios.
What is JSON?
A standard JSON file contains a single JSON value — most commonly an array of objects (e.g. [{...}, {...}, {...}]). The entire file must be parsed at once because the array is a single top-level structure. This makes standard JSON impractical for very large datasets: you must read the entire file into memory before processing any records.
JSON is the right format for APIs (request/response bodies), configuration, and datasets that are small enough to load at once. Most databases, tools, and languages have excellent JSON support and expect the standard single-document format.
What is NDJSON?
NDJSON (also called JSONL or JSON Lines) stores one complete JSON object on each line, with no separating commas and no wrapping array. Each line is independently valid JSON. This makes it trivial to stream: you process one line at a time without ever loading the full file into memory.
NDJSON is the natural output format for log aggregators (Fluentd, Logstash), Kafka consumers, database change-data-capture streams, and bulk API endpoints. Elasticsearch's bulk API requires NDJSON. It is also the format used by BigQuery table exports and many data pipeline outputs because it supports append-only writes — you add a new record by appending a line.
JSON vs NDJSON: Key Differences
| Feature | JSON | NDJSON |
|---|---|---|
| Structure | Single JSON value (usually an array) | One JSON object per line |
| Memory requirement | Full file must be parsed at once | Can be streamed line by line |
| File append | Requires rewriting the full array | Append a line — no rewrite needed |
| Partial read | Not possible without full parse | Read any range of lines |
| API compatibility | Universal — all REST APIs use JSON | Elasticsearch bulk, BigQuery, log systems |
| Streaming | Poor — not streamable | Excellent — designed for streaming |
| Human readability | Easier with pretty-print | One object per line — dense but scannable |
When to use JSON
- ✓Sending or receiving API request/response bodies
- ✓Datasets small enough to fit comfortably in memory
- ✓Configuration files or structured data documents
- ✓Tools or systems that expect a standard JSON array
When to use NDJSON
- ✓Log files and event streams (each event is one line)
- ✓Large datasets that must be processed record-by-record without full memory load
- ✓Kafka, Kinesis, or Pub/Sub consumer outputs
- ✓Elasticsearch bulk indexing, BigQuery streaming inserts
- ✓Appending records incrementally — no need to rewrite the file
Convert between JSON and NDJSON
Convert files instantly in your browser — no upload, no account, no server.
Convert JSON to NDJSON Online
Convert JSON files to NDJSON format directly in your browser. No upload required — your data never leaves your device.
Convert NDJSON to JSON Online
Convert NDJSON files to JSON format directly in your browser. No upload required — your data never leaves your device.
Convert NDJSON to CSV Online
Convert NDJSON files to CSV format directly in your browser. No upload required — your data never leaves your device.
More format comparisons
CSV vs Parquet
A practical comparison of CSV and Parquet — file size, query performance, compatibility, schema handling, and when to convert between them.
Parquet vs CSV
Parquet offers columnar storage, compression, and embedded schema. CSV is universal and human-readable. Learn the trade-offs and when to convert.
JSON vs CSV
JSON supports nested data and is native to APIs and web applications. CSV is flat, compact, and universally compatible with spreadsheets and databases.
CSV vs JSON
CSV is flat, compact, and universal for spreadsheets and databases. JSON supports nesting and is native to APIs and web applications. Learn when to use each.
Excel vs CSV
Excel supports formulas, charts, and multiple sheets. CSV is plain text, portable, and pipeline-friendly. Learn which to use and when to convert.
CSV vs Excel
CSV is plain text and pipeline-friendly. Excel supports formulas, multiple sheets, and charts. Learn when each is the right choice and how to convert.