Skip to main content
🇪🇸 Español 🇧🇷 Português 🇩🇪 Deutsch
Image Converter Video Converter Audio Converter Document Converter
Tools Guides Formats Pricing API
Log In
Guide

NDJSON & JSON Lines: The Complete Guide to Streaming JSON Format

PC By Pablo Cirre

Frequently Asked Questions

They are essentially the same format: one JSON value per line, newline-separated. NDJSON (ndjson.org) and JSON Lines (jsonlines.org) have slightly different formal specifications but in practice are identical. JSONL (.jsonl extension) is the most common file extension for machine learning datasets. NDJSON (.ndjson) is used by Elasticsearch's bulk API. The choice of name usually reflects which ecosystem you are working in rather than any technical difference.

They are essentially the same formato: one JSON value per line, newline-separated. NDJSON (ndjson.org) e JSON Lines (jsonlines.org) have slightly different formal specifications mas in practice are identical. JSONL (.jsonl extension) is the most common extensão de arquivo para machine learning datasets. NDJSON (.ndjson) is used by Elasticsearch's bulk API. The choice of name Geralmente reflects which ecosystem you are funcionando in em vez de any technical difference.

They are essentially the same Format: one JSON value per line, newline-separated. NDJSON (ndjson.org) und JSON Lines (jsonlines.org) have slightly different formal specifications aber in practice are identical. JSONL (.jsonl extension) is the most common Datei extension für machine learning datasets. NDJSON (.ndjson) is used by Elasticsearch's bulk API. The choice von name Normalerweise reflects which ecosystem you are working in rather than any technical difference.

They are essentially the same formato: one JSON value per line, newline-separated. NDJSON (ndjson.org) y JSON Lines (jsonlines.org) have slightly different formal specifications pero in practice are identical. JSONL (.jsonl extension) is the most common archivo extension para machine learning datasets. NDJSON (.ndjson) is used by Elasticsearch's bulk API. The choice de name Normalmente reflects which ecosystem you are working in rather than any technical difference.

AV1 is the most efficient (royalty-free, ~30% smaller than H.265) but encoding is slow. H.265 (HEVC) saves ~30–50% over H.264 and is supported by every modern phone and desktop. H.264 remains the safest baseline for legacy compatibility. Rule of thumb: archives → AV1, daily use → H.265, broadest reach → H.264.

Use NDJSON when: (1) your dataset has many records (100+ records — NDJSON scales to billions), (2) you need to process data in a streaming fashion without loading everything into memory, (3) you want to append records without rewriting the file, (4) you want parallel processing (split the file by lines across workers), (5) you are working with log data or time-series events. Use regular JSON when: you have a single complex document with nested structure, you need indentation for human readability, or you are working with config files.

Use NDJSON when: (1) your dataset has many records (100+ records — NDJSON scales to billions), (2) Você precisa process data em um streaming fashion sem loading everything em memory, (3) you querer append records sem rewriting o arquivo, (4) you want parallel processing (split o arquivo by lines across workers), (5) you are funcionando com log data ou time-series events. usar regular JSON when: you have a single complexo document com nested structure, you need indentation para human readability, ou you are funcionando com config files.

Verwende NDJSON, wenn: (1) dein Datensatz viele Einträge hat (NDJSON skaliert in Milliardenbereich); (2) du Daten im Streaming verarbeiten musst, ohne alles in den Speicher zu laden; (3) du Einträge anhängen willst, ohne die ganze Datei neu zu schreiben; (4) du parallele Verarbeitung willst (Datei nach Zeilen auf Worker aufteilen); (5) du mit Log-Daten oder Time-Series-Events arbeitest. Verwende reguläres JSON, wenn du ein einzelnes komplexes Dokument mit verschachtelter Struktur hast, lesbare Einrückung für Menschen brauchst oder mit Konfigurationsdateien arbeitest.

Usa NDJSON cuando: (1) tu dataset tenga muchos registros (NDJSON escala a miles de millones); (2) necesites procesar datos en streaming sin cargar todo en memoria; (3) quieras añadir registros sin reescribir el archivo entero; (4) busques procesamiento paralelo dividiendo el archivo por líneas entre workers; (5) trabajes con logs o eventos time-series. Usa JSON tradicional cuando tengas un único documento complejo con estructura anidada, necesites indentación legible para humanos o gestiones archivos de configuración.

CRF (Constant Rate Factor) is the best default for offline files: ffmpeg picks the bitrate frame-by-frame to maintain perceived quality. Two-pass is only better when you must hit an exact final size (DVD targets). Constant bitrate is for streaming with a fixed channel. For "smallest at quality X" always use CRF.

Read it line by line instead of loading the entire file: `import json; f = open("data.jsonl", encoding="utf-8"); records = (json.loads(line) for line in f if line.strip())`. This is a generator expression — it reads and processes one line at a time without storing the full file in memory. For pandas, use `pd.read_json("data.jsonl", lines=True, chunksize=10000)` to read in chunks. For very large files (multi-GB), use `python -m json.tool --lines` or Apache Spark's `spark.read.json("data.jsonl")` which partitions reading across a cluster.

Read it line by line em vez de loading the entire file: `import json; f = open("data.jsonl", codificação="utf-8"); records = (json.loads(line) para line in f if line.strip())`. This is a generator expression — it reads e processes one line at a time sem storing the full arquivo in memory. para pandas, usar `pd.read_json("data.jsonl", lines=True, chunksize=10000)` to read in chunks. para very large arquivos (multi-GB), usar `python -m json.tool --lines` ou Apache Spark's `spark.read.json("data.jsonl")` which partitions reading across a cluster.

Read it line by line anstatt loading the entire file: `import json; f = open("data.jsonl", Codierung="utf-8"); records = (json.loads(line) für line in f if line.strip())`. This is a generator expression — it reads und processes one line at a time ohne storing the full Datei in memory. für pandas, verwenden `pd.read_json("data.jsonl", lines=True, chunksize=10000)` to read in chunks. für very large Dateien (multi-GB), verwenden `python -m json.tool --lines` oder Apache Spark's `spark.read.json("data.jsonl")` which partitions reading across a cluster.

Read it line by line en vez de loading the entire file: `import json; f = open("data.jsonl", codificación="utf-8"); records = (json.loads(line) para line in f if line.strip())`. This is a generator expression — it reads y processes one line at a time sin storing the full archivo in memory. para pandas, usar `pd.read_json("data.jsonl", lines=True, chunksize=10000)` to read in chunks. para very large archivos (multi-GB), usar `python -m json.tool --lines` o Apache Spark's `spark.read.json("data.jsonl")` which partitions reading across a cluster.

Common causes: (1) variable framerate source rendered as constant (use <code>-vsync vfr</code> to preserve VFR); (2) different audio sample rates not resampled (add <code>-ar 48000</code>); (3) container limitations (MP4 with variable framerate misbehaves — prefer MKV during editing, encode to MP4 only at the end). Always run <code>ffprobe</code> on both source and output to compare timing.

With Python and pandas (simplest for well-structured data): `import pandas as pd; df = pd.read_json("data.jsonl", lines=True); df.to_csv("output.csv", index=False)`. With jq (command line): `cat data.jsonl | jq -r "[.field1,.field2,.field3] | @csv" > output.csv` (replace field names with actual column names; add a header line manually or via jq). Note: if JSONL records have varying fields (some records have extra fields), pandas will fill missing values with NaN; jq will output null for missing fields.

With Python e pandas (simplest para well-structured data): `import pandas as pd; df = pd.read_json("data.jsonl", lines=True); df.to_csv("output.csv", index=False)`. com jq (command line): `cat data.jsonl | jq -r "[.field1,.field2,.field3] | @csv" > output.csv` (replace field names com actual column names; add a header line manually ou via jq). Note: if JSONL records have varying fields (some records have extra fields), pandas will fill missing values com NaN; jq will output null para missing fields.

With Python und pandas (simplest für well-structured data): `import pandas as pd; df = pd.read_json("data.jsonl", lines=True); df.to_csv("output.csv", index=False)`. mit jq (command line): `cat data.jsonl | jq -r "[.field1,.field2,.field3] | @csv" > output.csv` (replace field names mit actual column names; add a header line manually oder via jq). Note: if JSONL records have varying fields (some records have extra fields), pandas will fill missing values mit NaN; jq will output null für missing fields.

With Python y pandas (simplest para well-structured data): `import pandas as pd; df = pd.read_json("data.jsonl", lines=True); df.to_csv("output.csv", index=False)`. con jq (command line): `cat data.jsonl | jq -r "[.field1,.field2,.field3] | @csv" > output.csv` (replace field names con actual column names; add a header line manually o via jq). Note: if JSONL records have varying fields (some records have extra fields), pandas will fill missing values con NaN; jq will output null para missing fields.

Yes if you only change the container: <code>ffmpeg -i in.mkv -c copy out.mp4</code>. This remuxes the stream without re-encoding, takes seconds even for hours of footage. Limitations: codec must be supported by the target container (e.g. you cannot put H.264 in WebM, only VP8/VP9/AV1). To shrink size you must re-encode.

We use cookies and similar technologies to personalise content and ads, and to analyse traffic. Learn more about cookies.