JSON to JSON Lines (JSONL) Converter
Convert a JSON array into JSON Lines: each element is written compactly on its own line — the format BigQuery, Elasticsearch, Spark, log pipelines and fine-tuning APIs expect.
JSON to JSONL
Runs in your browser — nothing you enter is uploaded or stored.
Scratchpad auto-saved
How it works — in four simple steps
No signup and nothing to install — it all runs in your browser.
Add your JSON
Paste it into the left box, press Open file, or drag a .json file onto it. Sample loads a realistic example.
Set the options
Adjust the options above the boxes — the output updates instantly as you change them.
Check the result
Read the status line: it reports rows, keys and any value that couldn't be represented in JSON Lines.
Copy or download
Copy the JSON Lines or download it as a .jsonl file. Nothing was uploaded at any point.
Wrapped in {"data": [...]}? Paste only the inner array so each record gets its own line.
Features
Private by design
Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.
About the JSON to JSONL
JSON Lines is the streaming-friendly cousin of JSON: instead of one big array, every record sits on its own line as compact JSON. Loaders can read it in parallel and append to it without rewriting the file. BigQuery's "newline-delimited JSON" source format, Elasticsearch's _bulk body, Spark's and pandas' lines=True readers, and LLM fine-tuning uploads all use it.
The converter parses your JSON (with line-and-column error messages if it's invalid) and writes each element of a top-level array as one line of minified JSON, in order, with a final newline. Whitespace inside values is preserved exactly; only the formatting between tokens is removed. If the top level is an object or a single value rather than an array, it's written as one line.
Download saves a .jsonl file. Unicode characters are written as-is (UTF-8), not as \u escapes, which keeps files readable and smaller.
Examples
Two chat examples prepared as an array — each becomes one line of a fine-tuning file.
[
{
"messages": [
{ "role": "user", "content": "Convert 2 km to miles" },
{ "role": "assistant", "content": "2 km ≈ 1.243 miles." }
]
},
{
"messages": [
{ "role": "user", "content": "What is 15% of 240?" },
{ "role": "assistant", "content": "15% of 240 is 36." }
]
}
]{"messages":[{"role":"user","content":"Convert 2 km to miles"},{"role":"assistant","content":"2 km ≈ 1.243 miles."}]}
{"messages":[{"role":"user","content":"What is 15% of 240?"},{"role":"assistant","content":"15% of 240 is 36."}]}This output was produced by the converter on this page with the default options — load it with the “Fine-tuning set” preset above and change any option to see the effect.
How JSON maps to JSON Lines
| In JSON | Becomes in JSON Lines |
|---|---|
[ {…}, {…} ] | two lines, one object each |
| Pretty-printed element | minified onto one line |
| Nested arrays/objects in an element | kept inside that line |
| Top-level object | a single line |
"é", emoji | written as UTF-8 characters |
| End of output | a trailing newline |
Things that trip people up
- Records inside a wrapper object. APIs often return {"data": [...]}. Only a top-level array is split into lines, so paste the inner array (or delete the wrapper) first.
- Fine-tuning formats. Chat fine-tuning files usually need each line to be {"messages": [...]}. Shape your array that way before converting.
- Line breaks in strings. Newlines inside strings are escaped as \n by JSON itself, so a record never spills onto a second line.
- Elasticsearch _bulk. The bulk API needs an action line before each document; JSONL from here gives you the document lines to interleave.
JSON vs JSON Lines at a glance
| Property | JSON | JSON Lines |
|---|---|---|
| Specification | RFC 8259 (2017) · ECMA-404 | jsonlines.org · NDJSON |
| File extension | .json | .jsonl / .ndjson |
| Media type | application/json | application/x-ndjson (common) |
| Data types | string, number, boolean, null, object, array | any JSON value per line |
| Comments | No | No |
| Nesting | Unlimited | Unlimited (per line) |
- JSON: Numbers are parsed as IEEE-754 doubles in JavaScript, so integers above 9,007,199,254,740,991 (2⁵³ − 1) lose precision.
- JSON Lines: One complete JSON value per line, UTF-8, separated by \n — so files can be streamed, appended and split without parsing the whole thing.