Your data never leaves your browser; nothing you paste is uploaded. The Send buttons appear only in JSONL to JSON mode, because JSONL itself is not valid JSON, and they pass the result between pages inside your browser tab only.
JSON to JSONL Converter
Convert a JSON array to JSONL, or JSONL to JSON, in your browser. Your data never leaves your browser, and nothing you paste is uploaded.
A JSON to JSONL converter turns one big JSON array into JSON Lines, where every record sits on its own line. That is the shape many pipelines expect: fine-tuning datasets for large language models, BigQuery and log-processing loads, files that are appended to over time, and exports too large to open as a single array. Use this page to convert JSON to JSONL online, or back again, free with no upload: your data never leaves your browser.
How do I convert JSON to JSONL?
Leave JSON to JSONL selected, paste a JSON array or upload a file, and each element becomes one compact line. If your array is wrapped in a response, type its path, such as data.items. Copy the result or download converted.jsonl. Nothing is uploaded, and number text is kept exactly.
Each element is written without extra spaces or line breaks, so a record never spans two lines. You can pick LF or CRLF line endings and switch the trailing newline on or off.
How to use this converter
- Choose the direction with the two buttons at the top. Switching moves the current output into the input.
- Add your data by pasting it, choosing a file or dropping one on the upload box. Load sample inserts an example.
- Pick the options: array path, single value, line ending and trailing newline for JSONL; blank lines, invalid lines and indent for JSON. Changes apply live; press Convert to run it yourself.
- Copy or Download the result. In JSONL to JSON mode you can also send it to the formatter or the schema validator. Results over about 2 MB show a preview, but every button uses the whole result.
- Limits: live updates pause above about 1 MB, so press Convert. Up to 200 levels of nesting are accepted, and input above 50 MB is refused with a message.
How do I convert JSONL to JSON?
Choose JSONL to JSON and paste or upload your lines. Every non-blank line is parsed as JSON and the records are gathered into one JSON array, indented with 2 spaces, 4 spaces, a tab or minified. A line that is not valid JSON stops the conversion and is reported with its line number.
This is the quickest jsonl to json route when you need a normal array for a script or an API. Once you have the array, pretty-print and validate it on the homepage, put its keys in a stable order so diffs stay small, or check every record against a schema. Spreadsheet exports can be turned into records first with converting CSV rows to JSON. JSON Lines is also a common shape for LLM batch files, and the LLM token counter shows how many tokens a record or a whole file will use. To see how another compact format compares for prompts, try the JSON to TOON converter.
What is the difference between JSONL, JSON Lines and NDJSON?
There is no practical difference. JSON Lines (.jsonl) and NDJSON, newline-delimited JSON (.ndjson), both mean one JSON value per line, separated by line breaks. The names come from two small specifications that agree on the format. This tool reads and writes both, so treat it as a JSON Lines converter or an NDJSON converter.
The file extension rarely matters to parsers; what matters is that every line is a complete value. For the history and tooling, see the JSON Lines format guide. If you are new to the underlying format, what JSON is and how it is written is a good start.
Why use JSONL instead of a JSON array?
A JSON array must be complete and valid before any of it can be trusted, and it has to be read as a whole. JSONL can be appended to, split, sampled and streamed line by line, and one corrupt line costs one record instead of the whole file. That makes it better for logs, datasets and big exports.
The trade-off is that JSONL is not valid JSON as a file, so ordinary JSON tools reject it. Convert back to an array when you need one.
Worked examples: JSON to JSONL and back
Both results below were produced by this tool with the default options. The first converts a 3-record array to JSONL (3 records, 3 lines).
JSON input
[
{
"id": 1,
"name": "Ada",
"tags": [
"math",
"code"
]
},
{
"id": 2,
"name": "Linus",
"tags": []
},
{
"id": 3,
"name": "Grace \"Amazing\"",
"note": "line1\nline2",
"score": 1.0
}
]
JSONL output
{"id":1,"name":"Ada","tags":["math","code"]}
{"id":2,"name":"Linus","tags":[]}
{"id":3,"name":"Grace \"Amazing\"","note":"line1\nline2","score":1.0}
The second converts that JSONL back to a JSON array (3 lines, 3 records).
JSONL input
{"id":1,"name":"Ada","tags":["math","code"]}
{"id":2,"name":"Linus","tags":[]}
{"id":3,"name":"Grace \"Amazing\"","note":"line1\nline2","score":1.0}
JSON output (2 spaces)
[
{
"id": 1,
"name": "Ada",
"tags": [
"math",
"code"
]
},
{
"id": 2,
"name": "Linus",
"tags": []
},
{
"id": 3,
"name": "Grace \"Amazing\"",
"note": "line1\nline2",
"score": 1.0
}
]
JSONL gotchas
Each result below comes from running the tool.
1. Every line must be a complete JSON value
A pretty-printed object spread over several lines is not JSONL. Pasting { "a": 1 } split over three lines gives: Line 1, column 2: Unexpected end of input, expected a quoted key.
2. No pretty printing, and newlines inside strings stay escaped
A raw line break would split a record in two, so JSON to JSONL writes compact lines and keeps newlines inside strings as \n. The array ["a\nb","c"] becomes "a\nb" | "c", shown with a bar between the two lines.
3. Blank lines and the trailing newline
A final line break is normal and is not a blank line. For {"a":1}\n\n{"a":2}\n the tool reports 3 lines, 2 records, 1 blank. With Skip blank lines off it stops: Line 2 is blank. Tick "Skip blank lines" to ignore blank lines.
4. BOM and CRLF
A leading byte order mark is removed and both LF and CRLF line endings are accepted. A BOM plus CRLF input gives [{"a":1},{"a":2}], the same as plain LF input: identical.
5. A top-level object is not an array
JSON to JSONL needs an array. For {"data":{"items":[{"a":1},{"a":2}]}} the tool says: The top level is an object, not an array. Enter an Array path (for example data.items), or tick "Treat a single value as one line". Entering the Array path data.items gives {"a":1} | {"a":2}.
6. Large numbers and 1.0 are preserved
Plain JSON.parse and stringify turn [12345678901234567890,1.0] into [12345678901234567000,1]. This tool writes 12345678901234567890 | 1.0, keeping every digit and the trailing zero.
7. Invalid lines are reported with their line number
For a file with a bad second line the tool stops with: Line 2, column 6: Unexpected character "}". With Skip invalid lines it keeps the good records instead (4 lines, 2 records, 2 skipped) and lists them: Skipped lines: 2, 4.
Frequently Asked Questions
What is JSONL?
JSONL, also called JSON Lines or NDJSON, is a text format with one complete JSON value on every line, usually an object. Because each line stands alone, a program can read, append or stream records one at a time without loading a whole file. It is common for logs, exports and machine learning datasets.
How do I convert JSON to JSONL?
Choose JSON to JSONL, paste a JSON array or upload a file, and each element of the array becomes one compact line of the result. If the array sits inside a response, enter its path, such as data.items. Then copy the result or download it as converted.jsonl.
How do I convert JSONL to JSON?
Choose JSONL to JSON and paste or upload the lines. Each non-blank line is parsed as JSON and the records are collected into a JSON array, which you can indent with 2 spaces, 4 spaces, a tab or minify. Copy it, download converted.json, or send it to the formatter.
How are invalid lines handled?
By default the conversion stops at the first invalid line and names the line number and the column inside that line. Choose Skip invalid lines to keep the good records instead: the page then lists the skipped line numbers, the first 20 followed by a count of the rest. Blank lines are skipped by default.
Is my data uploaded anywhere?
No. Parsing and conversion run as JavaScript in your browser, so your data never leaves your browser. The two Send buttons, available when you convert JSONL to JSON, pass the result to another page on this site inside your browser tab only.
Built and maintained by Deepak Kumar, a developer who wanted a JSON tool that respects your privacy. Your data never leaves your browser.