JSONL Converter
Convert JSONL and NDJSON to JSON arrays and back, validate each line, and export valid records in your browser. Large IDs and other numbers keep the exact digits you pasted.
- Runs in your browser
- Your data never leaves your browser
- 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 browser’s parser message; Chrome reports Expected double-quoted property name in JSON at position 27 (line 1 column 28) (the position counts from the start of that line). Firefox and Safari word the message differently. 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.
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?
All parsing, validation, conversion, and file export run inside your browser with local JavaScript APIs.