JSON to JSONL Converter
100% client-side. Your data never leaves the browser.
Convert
JSON to JSONL Converter
Paste a JSON array, get JSONL back — one record per line, ready for OpenAI / Anthropic fine-tune uploads, BigQuery loads, or any tool that expects newline-delimited JSON.
Before you start
You need a top-level JSON array — something that opens with [ and closes with ]. Each item inside the array becomes one line in the output. That item can be an object, a number, a string, even a nested array; whatever it is, I will JSON.stringify it onto a single line.
If your file is a single bare object ({...}) instead of an array, this tool can't help directly — JSONL is fundamentally a stream of records, so you'll need to wrap it: [{...}]. If your file is already JSONL, you're done; you don't need this tool.
There is no hard size limit beyond your browser's memory. The whole array gets parsed into a JS value first, so for very large files (over ~200 MB) I'd recommend a CLI like jq -c '.[]' input.json > out.jsonl instead.
Why JSONL is everywhere now
JSONL (sometimes called NDJSON) has quietly become the default for one specific reason: LLM fine-tuning. Both OpenAI and Anthropic require fine-tune training files in JSONL format — one chat example per line. If your training data starts life as a JSON array exported from a database or a labelling tool, you need to "unwrap" it before uploading. That's literally what this page does.
Beyond fine-tunes, JSONL shows up in:
- BigQuery / Snowflake / Athena bulk loads, where each line gets parsed independently so the loader doesn't have to hold the entire file in memory.
- Logging pipelines — Fluent Bit, Vector, and Logstash all emit and consume NDJSON natively.
- Kaggle and HuggingFace datasets, where streaming row-by-row beats loading a 4 GB JSON array into pandas.
- Embeddings exports from OpenAI, Cohere, and Voyage — typically one vector per line.
How to use it
- Paste your JSON array into the Input pane, or drop a
.jsonfile onto the page. - Click JSON array → JSONL. I parse the whole array, then stringify each element onto its own line.
- Check the status bar for the line count, or the error pane if something failed to parse.
- Click Copy or Download .jsonl to save the result.
Example
Input (JSON array):
[
{"id": 1, "user": "Ada"},
{"id": 2, "user": "Linus"}
]
Output (JSONL):
{"id":1,"user":"Ada"}
{"id":2,"user":"Linus"}
Notice that the output is minified on each line — that's what every JSONL consumer expects. Trailing newline included so cat file1 file2 > combined still works.
Fine-tune dataset workflow
If you exported a chat dataset from a labelling tool as a JSON array, the typical pipeline looks like:
- Paste the array here, click convert. Now it's JSONL.
- Run the result through the OpenAI Fine Tune Validator to catch missing
messagesarrays, bad roles, or empty assistant turns. - Upload to OpenAI's
filesendpoint and start your fine-tune job.
I built these three tools to be used in sequence — they live in the same browser tab and don't need anything installed.
Tips & common pitfalls
- Trailing commas will break the parse. Standard
JSON.parseis strict. If your array ends with..., ], fix it first. - The output is minified per line. JSONL consumers don't tolerate pretty-printed records that span multiple lines — every line break in the output marks a new record. If you need pretty objects, use the Formatter after this step.
- Each line is independent JSON. That means a single broken record won't poison the rest of the file the way it would in a giant array — that's the whole point of JSONL for big datasets.
- Strings, numbers, and arrays are all valid lines. JSONL doesn't require objects. If your input is
[1, 2, 3], the output will be three lines:1,2,3.
Troubleshooting
It says "Expected a JSON array at top level."
Your input parsed as JSON, but it wasn't an array — it was probably an object. Wrap it in square brackets, or if you actually have JSONL already (multiple objects with no commas between them), just use the file directly; you don't need this tool.
"Input is not valid JSON."
Common culprits: trailing commas, single quotes instead of double quotes, unescaped newlines inside strings, or a leading byte-order mark. Run it through the Validator if you can convert to JSONL first, or paste into a JSON linter to find the exact offset.
My browser tab froze.
The whole array gets parsed into memory, then each item is serialized again. For files over a few hundred megabytes, that doubles memory use. Use jq -c '.[]' input.json on the command line for huge files.
Related tools
See also: if you need to do something adjacent on this site, try JSONL to CSV to flatten your fresh JSONL into a spreadsheet, Formatter to pretty-print or minify each JSONL record, or Viewer to inspect the converted records before uploading.
Frequently asked questions
What's the difference between JSON, JSONL, and NDJSON?
JSON is the format. JSONL (JSON Lines) and NDJSON (Newline Delimited JSON) are two names for the same convention: a file where every line is one self-contained JSON value. Both names refer to the same byte stream.
Does this tool keep my key order?
Yes. JSON.parse followed by JSON.stringify on a modern engine preserves the insertion order of string keys, so your records won't be shuffled.
Can I use this for OpenAI / Anthropic fine-tune files?
That's the main use case. Convert here, then run it through the OpenAI Fine Tune Validator to check role/content/assistant requirements before you upload.
What about a JSON file that's a stream of objects with no array brackets?
That's already JSONL (or "concatenated JSON"). You don't need this tool — feed it directly to whatever consumer wants newline-delimited records.
How can I do this from the command line?
jq -c '.[]' input.json > output.jsonl is the standard one-liner. For Python: import json; [print(json.dumps(x)) for x in json.load(open('in.json'))].
Is my file uploaded anywhere?
No. Every byte stays in your browser tab. The conversion runs in JavaScript on your machine, which is why I'm comfortable using this for sensitive training data and you should be too.