
JSONL.rest
The definitive resource for JSON Lines format - Your go-to reference for streaming data, AI training, and efficient log processing

Our Mission
JSONL.rest is the Wikipedia of JSON Lines format - a comprehensive, developer-focused resource that serves as the single source of truth for everything JSONL. Whether you're processing streaming data, training AI models, or managing massive log files, we provide the knowledge and tools you need.
This site isn't just a collection of documentation; it's a living project built from real-world experience. The team at RJL.dev - a group of practicing software engineers and architects - created and actively maintains every piece of content you'll find here. We've navigated the challenges, debugged the tricky edge cases, and optimized the patterns so you can learn from our expertise.
Built by developers, for developers. We believe in making data formats accessible, understandable, and easy to implement. From beginners to experts, JSONL.rest is your trusted companion in the world of newline-delimited JSON.
Validate Your JSONL Data
Check syntax, detect errors, verify schema consistency, and auto-fix common mistakes - all in your browser, 100% private and free.
Open ValidatorWhat This Reference Contains
No vanity metrics here. Every number below is a straight count of the content published on this site, and you can check each one yourself by opening the page it points to.
Reference Pages
Glossary Terms Defined
Parser Errors Decoded
Common Mistakes Explained
Languages With Code Examples
Server Round Trips To Validate
What is JSONL?
Definition
JSON Lines (JSONL), also known as Newline Delimited JSON (NDJSON), is a convenient format for storing structured data that may be processed one record at a time. Each line is a valid JSON value, separated by newline characters.
Core Benefits
Built for Streaming: Process one line at a time - ideal for data streams or massive files
Low Memory Footprint: Handle terabyte files on machines with minimal RAM
Easily Appendable: Add new data by appending a line - no parsing or rewriting required
Robust: One corrupted line won't break the entire file
Quick Example
JSON (Traditional)
[
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25},
{"name": "Charlie", "age": 35}
]JSONL (Lines)
{"name": "Alice", "age": 30}
{"name": "Bob", "age": 25}
{"name": "Charlie", "age": 35}Notice: Each line is an independent JSON object - perfect for streaming and processing!

JSONL Quick Facts
| Stands for | JSON Lines. Also known as NDJSON (Newline Delimited JSON). |
|---|---|
| File extensions | .jsonl and .ndjson |
| Structure | One JSON value per line, usually an object. No commas between lines, no outer brackets. |
| Encoding | UTF-8 |
| Media type | application/x-ndjson or application/jsonl |
| Best at | Large files, streams, logs and anything that grows by appending |
| Not ideal for | Small config files and column-heavy analytics, where JSON and Parquet fit better |
| Read more | The full definition and specification |
Where JSONL Is Used
You have probably used JSONL without choosing it. It is the upload format for AI fine-tuning, the on-disk format for container logs and the wire format for bulk and streaming APIs. Each use below links to a full guide.

AI Training Data
Fine-tuning files, batch inference requests and evaluation sets. One example per line means a dataset of millions streams through a tokenizer without filling memory.
Application Logs
Structured logging writes one JSON object per event. New entries are appended, and a crash mid-write damages one line instead of the whole file.
Data Streaming
A consumer can act on the first record while the last one is still being produced. A JSON array cannot do that, because its closing bracket arrives last.
Analytics Pipelines
Warehouses and query engines load and export it natively. Files split cleanly on newlines, so many workers can share one input.
Streaming and Bulk APIs
Endpoints that return open-ended result sets stream them as lines. Bulk import endpoints accept thousands of operations in one request body.
Import and Export
Moving data between systems: database dumps, search-index loads, dataset downloads. It converts to and from JSON, CSV and Parquet in one command.
Platforms That Read and Write JSONL
OpenAI
Fine-tuning files and Batch API input and output
Amazon Web Services
Bedrock batch inference, Athena tables over S3
Google Cloud
BigQuery load and export, Vertex AI tuning datasets
Microsoft Azure
Azure OpenAI fine-tuning and batch files
Docker
The default json-file container log driver
Elasticsearch
The Bulk API request body
Hugging Face
Dataset files loaded by the datasets library
Apache Spark
The default layout its JSON reader expects
The exact record shape each one expects is on the examples page.
Read and Write JSONL in 60 Seconds
No library is required in any mainstream language. Reading is "for each line, parse JSON". Writing is "serialize, add a newline". The languages page has complete examples for eight languages.
Python
import json
# Read
with open("data.jsonl", encoding="utf-8") as f:
for line in f:
record = json.loads(line)
# Write
with open("out.jsonl", "w", encoding="utf-8") as f:
for record in records:
f.write(json.dumps(record) + "\n")JavaScript (Node.js)
import { createReadStream } from 'node:fs';
import { createInterface } from 'node:readline';
const lines = createInterface({
input: createReadStream('data.jsonl'),
});
for await (const line of lines) {
const record = JSON.parse(line);
}Command Line
# How many records?
wc -l data.jsonl
# Show the first one, formatted
head -n 1 data.jsonl | jq .
# Keep only the active users
jq -c 'select(.active)' data.jsonl
# JSON array to JSONL
jq -c '.[]' data.json > data.jsonlJSONL vs JSON vs CSV vs Parquet
JSONL is not a replacement for every format. It wins when data arrives over time or is too big to hold in memory, and loses when you need a small hand-edited file or fast column scans.
| Question | JSONL | JSON | CSV | Parquet |
|---|---|---|---|---|
| Read one record at a time? | Yes | No, whole document | Yes | In row groups |
| Append without rewriting? | Yes | No | Yes | No |
| Nested objects and arrays? | Yes | Yes | No | Yes |
| Data types preserved? | JSON types | JSON types | Everything is text | Full typed schema |
| Readable in a text editor? | Yes | Yes | Yes | No, binary |
| Size on disk | Large, compresses well | Large | Small | Smallest |
| Best for | Logs, streams, AI datasets | Config, API responses | Flat tables, spreadsheets | Analytics at scale |
Go deeper: JSONL compared with JSON, CSV and XML and the detailed JSONL vs Parquet guide.
Explore the JSONL Reference
Every page on this site, grouped by what you are trying to do.
Learn the Format
Build With It
Validate and Fix
JSONL Questions, Answered Briefly
What is a .jsonl file?
A text file in which every line is one complete JSON value, normally an object. It opens in any text editor. To a program it is a list of records that can be read one at a time.
Is JSONL the same as NDJSON?
Yes. JSON Lines and Newline Delimited JSON describe the same bytes. Only the name, the file extension and the suggested media type differ. Renaming data.ndjson to data.jsonl changes nothing.
How do I open a JSONL file?
Any text editor works for small files. For large ones use head or less in a terminal, or paste a sample into the validator to view it as a table.
How do I convert JSON to JSONL?
If the JSON is an array of objects, write each element on its own line: jq -c '.[]' data.json. The conversion guide covers CSV, Parquet and other formats.
Why do AI platforms use JSONL?
A training set is a long list of independent examples. One example per line lets a platform validate, count, shuffle and stream them without loading the file, and report a bad example by its line number.
When should I not use JSONL?
For configuration files, for a single API response, and for analytics over a few columns of a very wide table. JSON reads better for the first two; a columnar format such as Parquet is far faster for the third.
More answers on the full FAQ page.
Ready to Master JSONL?
Explore comprehensive examples, read the specification, and discover when JSONL is the right choice for your project.