NDJSON vs CSV
NDJSON (Newline-Delimited JSON) and CSV are both line-oriented plain-text formats for tabular data, but they come from very different ecosystems. NDJSON is the format of streaming systems, event pipelines, and structured logs. CSV is the format of spreadsheets, databases, and data analysis. Knowing which to use depends on who produces your data and who consumes it.
What is NDJSON?
NDJSON (Newline-Delimited JSON), also known as JSON Lines, stores one JSON object per line. Each line is an independent, self-contained JSON document with no outer array wrapper. This structure makes NDJSON ideal for streaming — you can process records one line at a time without loading the entire file into memory, and append new records without rewriting the file.
NDJSON is used in log aggregation (Pino, Bunyan, Loguru), event streaming (Kafka consumers, Kinesis Firehose), Elasticsearch bulk indexing, and incremental database exports (change-data-capture). If you have ever tailed an application log and seen one JSON object per line, that is NDJSON.
What is CSV?
CSV (Comma-Separated Values) is a plain-text tabular format — one row per line, commas as delimiters, column names in the first row. Every analytics tool, database import utility, spreadsheet application, and programming language reads CSV by default. It is the universal interchange format for flat tabular data.
CSV's strength is its simplicity and tool support. A CSV file opens in Excel, reads in Python, loads into PostgreSQL with COPY, and parses in JavaScript without any configuration. The tradeoff is that CSV has no support for nested data, no native type information, and can require quoting when values contain commas.
NDJSON vs CSV: Key Differences
| Feature | NDJSON | CSV |
|---|---|---|
| Structure | One JSON object per line | Flat rows and columns |
| Nesting support | Full (nested objects and arrays) | None |
| Schema | Implicit (per-record keys) | First-row headers |
| Streaming / append | Excellent (line-by-line) | Possible (append rows) |
| Spreadsheet support | No — requires conversion | Native |
| Database import | Requires conversion or json functions | Direct (COPY, LOAD DATA) |
| File size | Verbose (key names per record) | Compact |
| Log / event systems | Native | Uncommon |
| Human readable | Yes | Yes |
When to use NDJSON
- ✓Application logs and structured event data emitted by logging frameworks
- ✓Streaming pipeline outputs from Kafka, Kinesis, or Pub/Sub consumers
- ✓Elasticsearch or OpenSearch bulk indexing (requires NDJSON format)
- ✓Incremental database exports where records are appended over time
- ✓Data with nested or variable structure that does not fit a flat schema
When to use CSV
- ✓Loading data into a relational database or data warehouse
- ✓Opening and analysing in Excel, Google Sheets, or a BI tool
- ✓Sharing flat tabular data — CSV is more compact than NDJSON for flat data
- ✓Feeding a pipeline or ETL tool that expects standard tabular input
- ✓Any workflow where maximum tool compatibility is required
Convert between NDJSON and CSV
Convert files instantly in your browser — no upload, no account, no server.
Convert NDJSON to CSV Online
Convert NDJSON files to CSV format directly in your browser. No upload required — your data never leaves your device.
Convert CSV to NDJSON Online
Convert CSV files to NDJSON format directly in your browser. No upload required — your data never leaves your device.
Convert NDJSON to Parquet Online
Convert NDJSON files to Parquet 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.