How to use it
- Paste a JSON array, or drop a
.jsonfile, into the left pane. - The right pane shows one minified record per line, and the status bar shows the line count, for example
2 lines. - Download saves the result as
data.jsonl, ready to upload.
If the input isn’t valid JSON, you get the exact line and column of the problem. If the top-level value isn’t an array, the tool says so instead of guessing.
Example
The built-in sample, an array of batch requests:
[
{ "custom_id": "req-1", "method": "POST", "url": "/v1/messages", "body": { "max_tokens": 256, "messages": [ … ] } },
{ "custom_id": "req-2", "method": "POST", "url": "/v1/messages", "body": { "max_tokens": 256, "messages": [ … ] } }
]
becomes:
{"custom_id":"req-1","method":"POST","url":"/v1/messages","body":{"max_tokens":256,"messages":[{"role":"user","content":"Summarize TOON in one line."}]}}
{"custom_id":"req-2","method":"POST","url":"/v1/messages","body":{"max_tokens":256,"messages":[{"role":"user","content":"What is JSONL?"}]}}
Why JSON Lines instead of one big array?
- Streaming. Consumers can process one line at a time without loading the whole file into memory.
- Appending. Adding a record is a single write at the end of the file, with no closing
]to rewrite. - Fault isolation. A bad record breaks one line, not the entire file.
- Unix-friendly.
wc -l,head,splitandgrepwork on records directly.
That’s why batch APIs (OpenAI, Anthropic), fine-tuning datasets and BigQuery’s newline-delimited JSON loader all use this format.
Things to check before uploading
- Required fields. Batch APIs need a unique
custom_idon every line, and fine-tuning files must follow the exact schema the provider documents. - One JSON value per line. Strings that contain line breaks are safe: minification keeps them escaped as
\n. - Valid input first. Invalid JSON is reported with its line and column, and the error panel offers Fix with JSON Repair for trailing commas, comments or truncated output. To eyeball the records before exporting, open the array in the JSON Viewer.
- File size limits. Providers cap the size and number of lines per file. Use
split -l 10000 data.jsonl part_to break up large files.
On the command line
jq -c '.[]' data.json > data.jsonl
import json
with open("data.jsonl", "w", encoding="utf-8") as f:
for row in rows:
f.write(json.dumps(row, ensure_ascii=False) + "\n")
Both re-serialize numbers: Python keeps integers exact but writes 1.50 as 1.5, and jq versions before 1.7 round integers above 2^53. This tool writes every number exactly as it appears in the input.
To turn JSONL back into an array, or to validate a JSONL file line by line, use JSONL to JSON. For spreadsheets, use JSON to CSV.
Frequently asked questions
What input does the tool accept?
A JSON array. Each element — object, array, string, number, boolean or null — becomes exactly one line. If you paste a single object, you get an error asking for an array; wrap it in [ ] first.
Are numbers and key order preserved?
Yes. Elements are minified without being converted to JavaScript numbers, so 9007199254740993 and 1.50 stay exactly as written, and keys keep their original order.
Does the output end with a newline?
Yes. The file ends with a trailing newline, which is what most JSONL consumers and POSIX tools expect.
How do I turn JSONL back into an array?
Click Reverse above the output to send the lines to JSONL to JSON, or open that tool directly. It validates every line and reports the line number of the first broken record.
Is my data uploaded?
No. The conversion runs entirely in your browser, and nothing is uploaded.
Last updated