JSONL vs JSON
Updated November 4, 2026
JSON stores one document per file, while JSONL stores one JSON value per line. Use JSON for configuration and API responses, where the data is one structure. Use JSONL for many similar records, especially when a file is large or keeps growing.
[
{"id": 1, "name": "Ada"},
{"id": 2, "name": "Lin"}
]
The same data as JSONL:
{"id": 1, "name": "Ada"}
{"id": 2, "name": "Lin"}
Comparison
| JSON | JSONL | |
|---|---|---|
| Structure | One document | One value per line |
| Reading | Most parsers load the whole document | One line at a time |
| Memory | Grows with file size | Stays flat when streaming |
| Appending | Rewrite the closing bracket | Add a line |
| Damaged data | The whole document fails to parse | Only the bad line fails |
| Splitting | Needs a parser | Split at any newline |
| Pretty-printing | Allowed | Not allowed, one line per record |
| Tool support | Universal | Common in data and LLM tools |
When to use JSON
- Configuration files
- API request and response bodies
- Nested data that forms a single structure
- Files that people read and edit by hand
When to use JSONL
- Datasets with many records of the same shape
- Logs and event streams
- LLM fine-tuning data and batch API files
- Files too large to load comfortably into memory
Converting between them
Use the JSON to JSONL converter or the JSONL to JSON converter. With jq:
# JSON array to JSONL
jq -c '.[]' data.json > data.jsonl
# JSONL to JSON array
jq -s '.' data.jsonl > data.json
The second command holds every record in memory, so it can struggle with very large files.