.jsonlapplication/x-ndjsonLLM & Streaming FormatsJSON Lines (NDJSON) (JSONL)
LLM fine-tuning datasets (OpenAI/Anthropic ChatML), evaluation benchmarks, batch APIs, and append-only structured logs.
JSON Lines (JSONL / NDJSON) stores one self-contained JSON value per UTF-8 newline, enabling line-by-line streaming, sharding, and OpenAI/HuggingFace training pipelines without parsing the entire file.
| Property | JSONL |
|---|---|
| File extension | .jsonl |
| MIME type | application/x-ndjson |
| Structure type | Line Stream |
| Encoding | UTF-8 Text |
| Nesting support | Yes |
| LLM token efficiency | Medium |
| Schema / typed | No |
| Best for | LLM fine-tuning datasets (OpenAI/Anthropic ChatML), evaluation benchmarks, batch APIs, and append-only structured logs. |
Strengths
- Streamable line by line — process or shard huge datasets without loading one giant JSON array
- Required format for OpenAI Fine-Tuning API, Batch API, and most LLM evaluation frameworks
- Append-only friendly for event logs and partial error recovery on individual lines
Trade-offs
- One malformed JSON line does not invalidate neighbors, but still halts strict dataset uploads unless audited
- Each line must stay compact (unescaped raw newlines inside strings break line boundaries)
- Higher byte footprint than columnar Parquet for numeric analytics
Convert & inspect JSONL locally
Stream JSON arrays or wrapped record lists into newline-delimited JSONL (NDJSON) for AI training and batch pipelines.
JSONL to JSONParse newline-delimited JSONL / NDJSON streams into a formatted JSON array with optional malformed-line skipping.
CSV to JSONLConvert CSV/TSV tables into raw JSONL, OpenAI ChatML messages[], Alpaca, or ShareGPT fine-tuning records locally.
JSONL to CSVFlatten nested JSONL / NDJSON records into RFC-4180 CSV with dot-notation headers and Excel UTF-8 BOM support.
JSONL ValidatorAudit every JSONL line for syntax errors, OpenAI ChatML role alternation, missing assistant turns, and per-line BPE token limits.
OpenAI Fine-Tune ConverterConvert Alpaca, ShareGPT, CSV, or prompt/completion pairs into validated OpenAI ChatML messages[] fine-tuning JSONL.
Split large JSONL datasets into exact-line ZIP shards or merge and deduplicate multiple JSONL files in browser memory.
Parquet to JSONLStream Apache Parquet rows directly into newline-delimited JSONL for LLM fine-tuning and evaluation pipelines in browser RAM.
Related engineering guides
Format, convert, validate, deduplicate, and shard ChatML JSONL fine-tuning datasets from CSV, Alpaca, ShareGPT, or Parquet locally in browser RAM.
Zero-Upload PII Redaction & Reversible Restore Before Sending Data to AIRedact emails, phone numbers, API keys, DB URIs, and salaries locally in browser RAM using [[TYPE-NN]] placeholders—then restore AI replies cleanly.
Convert HuggingFace Parquet Files to JSONL & CSV Without PythonConvert HuggingFace Parquet shards to JSONL, JSON, or UTF-8 BOM CSV locally in browser RAM using hyparquet and sql.js WASM—zero Python or uploads required.
OpenAI Batch API JSONL: Unwrapping, Sharding & Validation GuidePrepare OpenAI Batch API JSONL files locally: unwrap nested JSON arrays, deduplicate lines, split shards into ZIP archives, and flatten results to CSV.
Sanitize Server Logs, Webhook JSON & Payroll CSV Before AI PromptsScrub DB URIs, Bearer JWTs, AWS keys, and IPs from logs, mask JSON keys validly, scale CSV salaries by ×k, and lock sessions in AES-256-GCM .redactkey.
Offline LLM BPE Token Counting & Prompt Cost Optimization GuideCount exact o200k_base and cl100k_base BPE tokens offline, visualize token boundary segments, prune null JSON fields, and cut prompt API costs locally.
Related Comparisons
JSONL frequently asked questions
What is the difference between JSONL and NDJSON?
Both mean one valid JSON object per newline (\n). .jsonl is standard in AI fine-tuning datasets while .ndjson is common in HTTP streaming APIs.
How does OpenAI Fine-Tuning validate JSONL files?
Each line must be a valid JSON object containing a messages array with role and content fields, ending cleanly on an assistant turn.
Can I convert CSV or Alpaca datasets into OpenAI JSONL locally?
Yes. Use DataTo OpenAI Fine-Tune Converter or CSV to JSONL to map instruction/output columns into validated ChatML JSONL in browser RAM.