┌─ FILE ANALYSIS ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ┐
│ DEVELOPER : N/A (Community standard)
│ CATEGORY : Data
│ MIME TYPE : application/x-ndjson
└ ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ┘
What is an NDJSON file?
NDJSON (Newline-Delimited JSON, also called JSON Lines) is a text format where each line contains a valid JSON value, typically a JSON object. Unlike regular JSON arrays, NDJSON can be processed line by line without loading the entire file into memory, making it ideal for streaming, logging, and large datasets.
How to open NDJSON files
- Any text editor — Each line is a JSON object
- jq (Command-line) —
jq . file.ndjsonfor formatting - Python —
for line in open(): json.loads(line) - DuckDB —
SELECT * FROM 'file.ndjson'
Technical specifications
| Property | Value |
|---|---|
| Line Format | One JSON value per line |
| Separator | Newline (\n) |
| Encoding | UTF-8 |
| Streaming | Line-by-line processing |
| Also Known As | JSON Lines (.jsonl), LDJSON |
Common use cases
- Logging: Structured application logs (ELK stack).
- Data streaming: Apache Kafka, AWS Kinesis payloads.
- Bulk APIs: Elasticsearch bulk indexing format.
- Data exchange: Large dataset export/import.