How to use it
- Paste JSON Lines, or drop a
.jsonlor.ndjsonfile, into the left pane. - Every non-empty line is validated. If a record is invalid, you get its line number and a precise message, and the line is highlighted.
- The output is a single JSON array. Indent with 2 or 4 spaces or tabs, or Minify it.
The status bar shows the record count, for example 3 records → JSON array. Duplicate keys inside a record are flagged with the line they’re on.
JSONL format rules
- One complete JSON value per line. Usually an object, but any JSON value is allowed.
- No commas between records and no surrounding
[ ]. - Line breaks inside strings must be escaped as
\n. A literal line break splits the record in two. - UTF-8 encoding. A byte order mark at the start of the file is tolerated here, but some tools reject it. Windows (CRLF) line endings are fine.
Where you’ll meet JSONL
- LLM fine-tuning and evaluation datasets. Chat fine-tuning files contain one
{"messages": [...]}object per line, like the built-in sample. - Batch APIs. OpenAI and Anthropic batch jobs take one request per line and return results as JSONL.
- Data warehouses. BigQuery loads newline-delimited JSON, and many export tools produce it.
- Structured logs. Loggers such as pino and zap write one JSON object per event, which keeps logs easy to
grep,tailand stream.
Common mistakes the validator catches
| Mistake | Error you’ll see |
|---|---|
| Pretty-printed JSON saved as .jsonl | Record on line 1: Unclosed object … This looks like pretty-printed JSON |
| Trailing comma in a record | Record on line 2: Trailing comma is not allowed before } |
| Comma at the end of each line | Record on line 1: Unexpected ‘,’ after the end of the JSON value |
Single quotes from Python’s str(dict) |
Record on line 1: Strings must use double quotes |
If a record came from an LLM and is only slightly broken, fix it with JSON Repair and put it back on its line.
Converting on the command line
# JSONL → JSON array
jq -s '.' data.jsonl > data.json
# JSON array → JSONL
jq -c '.[]' data.json > data.jsonl
# Validate: jq stops at the first bad record and reports its line
jq -c '.' data.jsonl > /dev/null
import json
with open("data.jsonl", encoding="utf-8") as f:
rows = [json.loads(line) for line in f if line.strip()]
To create JSONL from an array, use JSON to JSONL. To inspect a single record in detail, paste it into the JSON Formatter.
Frequently asked questions
What is the difference between JSONL, NDJSON and JSON Lines?
They are names for the same format: one complete JSON value per line, separated by newlines. The JSON Lines (.jsonl) and NDJSON (.ndjson) specifications agree on everything that matters in practice.
Are blank lines allowed?
This tool skips empty and whitespace-only lines, so a trailing newline or blank separator lines won't cause errors. Some strict consumers reject them, so remove them before uploading to a picky service.
How big a file can I open?
Files you open or drop can be up to 20 MB. Every line is parsed in your browser at a few megabytes per second, so large files take a moment but never leave your machine.
Why do I get "This looks like pretty-printed JSON"?
Your first line contains only { or [, which means the file is regular multi-line JSON, not JSONL. Use the JSON Formatter for it, or turn a JSON array into JSONL with JSON to JSONL.
Does it keep large numbers exact?
Yes. Records are parsed with a lossless parser, so 64-bit IDs and values like 1.50 appear in the output exactly as written.
Last updated