JSONL Converter
Convert JSONL or NDJSON to a JSON array and back, validate each line, and keep large IDs exactly as pasted. Runs in your browser.
- Runs in your browser
- Tool input is not uploaded to ZeroTool servers
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Worked Example
Input JSONL:
{"id":1,"event":"signup","user":"alice"}
{"id":2,"event":"purchase","user":"bob","amount":29.99}
Output JSON array:
[
{
"id": 1,
"event": "signup",
"user": "alice"
},
{
"id": 2,
"event": "purchase",
"user": "bob",
"amount": 29.99
}
]
Numbers Keep Their Digits
The tool uses JSON.parse() only to check the syntax. It writes every number with the characters from the input, so IDs
above 253, trailing zeros and exponents survive both directions:
{"order_id":9007199254740993,"total":1.50,"rate":1e-7}
{"order_id":9007199254740994, "note":"caf\u00e9", "total":0}
[
{
"order_id": 9007199254740993,
"total": 1.50,
"rate": 1e-7
},
{
"order_id": 9007199254740994,
"note": "café",
"total": 0
}
]
A plain JSON.parse() followed by JSON.stringify() would write 9007199254740992 and
1.5. Strings are a different case: the tool writes them in the standard
JSON.stringify() form, so "caf\u00e9" becomes "café", and the space after a comma
disappears in compact JSONL.
Copy and Download
The Copy buttons and both downloads use the result of the last successful conversion. After JSONL → JSON, Download .json saves the array shown on the right, and the JSONL Copy and Download .jsonl give the converted records one per line in compact form. That is not the text you pasted: invalid lines left out by Convert valid lines only are gone and spacing is removed. After JSON → JSONL, Download .json saves your array formatted with the current Pretty JSON output setting.
The buttons are disabled before the first conversion and again as soon as you edit either panel, change Ignore empty lines or Convert valid lines only, click Clear (or press Ctrl+L / Cmd+L in the tool), or a conversion or a file read fails. Changing Pretty JSON output runs JSONL → JSON again when the JSONL panel has text. A failed conversion also empties the output panel, so you cannot copy a result that belongs to older input. Automatic validation on its own never enables them.
JSONL vs JSON Arrays
A JSON array wraps every record inside one large document. JSONL writes each record as a standalone JSON value on its own line. That line-oriented shape works well for logs, streaming exports, command-line processing, and large datasets where each record can be handled independently.
Example: One Bad Line in a Three-Line Export
Paste this into the JSONL panel and wait 350 ms for automatic validation:
{"id":1,"event":"signup"}
{"id":2,"event":"purchase",}
{"id":3,"event":"cancel"}
The counters show 3 lines, 2 valid, 1 error, 0 empty. The issue panel lists Line 2 with the column and the cause in the page language: Column 27, trailing comma before the closing bracket. (the column counts from the start of that line). JSONL → JSON stops with an error until you fix the line or tick Convert valid lines only. With the option on, the tool outputs records 1 and 3, reports "Converted 2 JSONL records to a JSON array.", and Download .jsonl saves:
{"id":1,"event":"signup"}
{"id":2,"event":"purchase",}
{"id":3,"event":"cancel"}
{"id":1,"event":"signup"}
{"id":3,"event":"cancel"}
Command-Line Equivalents
For repeatable scripts, jq does the same conversions (jq 1.7.1 output):
jq -c '.[]' data.json > data.jsonl # JSON array → JSONL
jq -s '.' data.jsonl > data.json # JSONL → JSON array
jq -c . bad.jsonl # stops at the first bad line:
# jq: parse error: Expected another key-value pair at line 2, column 28
jq stops at the first error. The tool parses every line and lists all failing lines at once.
Limits
- Duplicate keys keep the last value, as
JSON.parse()does:{"x":1,"x":2}becomes{"x":2}, at the place of the firstx. - Keys that look like array indexes move to the front of their object, in ascending order, as in a JavaScript object:
{"b":1,"2":2,"1":3}becomes{"1":3,"2":2,"b":1}. Values do not change. - JSON → JSONL accepts only a top-level array. An object or a single value produces "JSON input must be an array."
- Each record must sit on one line. A pretty-printed object spread across several lines fails on every line it spans. Lines are split on line feeds and trimmed, so Windows CRLF files work.
- The issue panel shows the first 40 failing lines; the error counter still counts all of them.
Related Tools
To inspect or pretty-print one JSON document, use JSON Formatter. To query the converted array with jq, use jq Playground. To validate records against a schema, use JSON Schema Validator.
FAQ
What is JSONL?
JSONL, also called JSON Lines or NDJSON, stores one complete JSON value per line. It is common in logs, data exports, streaming APIs, and AI datasets.
What JSON input can be converted to JSONL?
Paste a JSON array. Each array item becomes one compact JSONL line. Objects, arrays, strings, booleans and null are kept, and numbers keep the digits you wrote: 9007199254740993, 1.50 and 1e-7 come out unchanged.
How are empty lines handled?
Empty lines are ignored by default. Turn off the option to treat empty lines as line-level validation issues.
Can I export only valid JSONL records?
Yes. Tick Convert valid lines only and click JSONL → JSON. The JSON array then holds the valid records, and Download .jsonl saves the same records one per line. Automatic validation only checks the lines: the copy and download buttons stay disabled until a conversion succeeds.
Where is my data processed?
In this browser tab. Parsing, validation and conversion run in the page, and Open reads the file with the browser's FileReader, so the JSONL, the JSON and your files are not sent to a server, and the tool does not save them in browser storage. After a successful conversion the page records one analytics event with only the tool name and the direction (jsonl_to_json or json_to_jsonl), but not again when the direction, input and options are the same as for the previous event. Validation, Copy and Download send nothing.