Convert JSON Lines (JSONL) to JSON, CSV and back
JSON Lines, also called JSONL or NDJSON, stores one complete JSON value per line. Because every line stands on its own, a JSONL file can be streamed, appended to and split by line without parsing the whole document, which is why it is common for logs, exports, machine-learning datasets and bulk-import APIs. This JSONL converter moves data between JSON Lines and the formats around it: a JSON array, and CSV.
The question “JSONL vs JSON” comes down to shape. A JSON file is one document, usually an array wrapped in brackets with commas between records; a JSONL file has no brackets and no commas between records, just a newline. Use JSON when a program reads the whole thing at once, and JSONL when records are written or read one at a time. Converting is a matter of cutting the array apart or joining the lines together, and this page does exactly that, as text, so numbers such as 12345678901234567890 or 1.0 stay precisely as written.
Every conversion runs in your browser. Invalid lines are reported with their line number, which makes the tool useful as a JSONL validator before you upload a file to an API.
How to use the JSON Lines (JSONL) Converter
- Choose what to Convert: JSON array to JSONL, JSONL to JSON array, CSV to JSONL, JSONL to CSV, or Validate JSONL lines.
- Paste the data, drop in a file with Load file (.json, .jsonl, .ndjson or .csv), or start from the sample.
- Set the options that appear for that conversion: JSON indentation, CSV delimiter and header row, type detection, flattening of nested objects, line endings.
- Read the result and the notes underneath. Problems list the exact line number and the reason.
- Press Copy or Download. Use output as input, reverse swaps the direction so you can check a round trip.
JSON Lines (JSONL) Converter features
Lossless conversion
Large integers, number spellings and key order are preserved because records are never re-serialised.
Validation with line numbers
Every line is parsed on its own. The report lists each failing line with the parser’s message and the start of the text.
RFC 4180 CSV
Quoted fields, doubled quotes, commas and line breaks inside quotes, CRLF or LF, and automatic detection of comma, semicolon, tab or pipe delimiters.
Sensible types
CSV values that look like numbers, true/false or null become JSON values, while IDs with leading zeros and numbers over 15 digits stay strings. Turn it off to keep everything as text.
Nested data to columns
JSONL to CSV flattens nested objects into dotted columns such as address.city and keeps arrays as JSON text.
Pretty or minified JSON
Output an array with 2 spaces, 4 spaces, tabs or no whitespace.
JSON vs JSONL at a glance
The JSON Lines format is described at jsonlines.org and the very similar NDJSON at ndjson.org. Both require each line to be valid JSON with no line breaks inside it. Blank lines are not records; this tool ignores them and tells you how many it saw.
| JSON array | JSON Lines | |
|---|---|---|
| Layout | [{…},{…}] in one document | One value per line, no brackets or commas between records |
| Read | Whole file must be parsed | Line by line, even while the file is still being written |
| Append a record | Rewrite the closing bracket | Add a line at the end |
| Typical extension | .json | .jsonl or .ndjson |
| Encoding | UTF-8 (RFC 8259) | UTF-8; lines end with \n (\r\n is tolerated) |
Limits and choices
- JSONL to CSV needs a JSON object on each line. Lines holding arrays or plain values are reported (or skipped when you tick “Skip invalid lines”).
- JSONL to CSV parses numbers as JavaScript numbers, so a number with more than 15 digits can be rounded in the CSV. The page warns you; use JSON output to keep every digit.
- A CSV without a header row becomes an array per line. CSV rows with more or fewer fields than the header are kept, with a warning.
- To view the records as a grid, use the JSON to Table Viewer; for a plain JSON-to-CSV export with more control, use JSON to CSV; to query the lines, try the jq Playground.
JSON Lines (JSONL) Converter FAQ
What is the difference between JSONL and JSON?
JSON is one document, normally an array of records in brackets. JSONL puts one complete JSON value on each line with no surrounding brackets or commas, so files can be read and appended one record at a time.
How do I convert a JSON array to JSONL?
Choose “JSON array to JSONL”, paste the array and copy the result. Each element becomes one line. If the array sits inside an object, the tool finds it or lets you name its key.
How do I validate a JSONL file?
Choose “Validate JSONL lines” and paste or load the file. Every invalid line is listed with its line number and the parser’s message, and the cleaned valid lines appear in the output.
Why does my JSONL file have blank lines?
Many writers end with a newline or leave a trailing blank line. A final newline is normal. Blank lines elsewhere are not records, so this tool skips them and reports the count.
Is JSONL the same as NDJSON?
In practice yes: one JSON value per line separated by a newline. The specifications differ in small details, such as how blank lines are treated, but files that follow one are accepted by almost every reader of the other.
Is my data uploaded?
No. Parsing and conversion happen in your browser tab and the data stays on your device.