JSONL to CSV: the complete guide
The JSON Lines format, how it differs from a JSON array, and how to get clean, analysable CSV out of it.
What shape is the output?
A JSONL to CSV converter produces a standard CSV file: a single header row containing the union of keys found across every record, followed by one row per record. This is the shape that Excel, Google Sheets, pandas, and every database bulk loader expect, and it is why JSONL becomes immediately analysable once converted.
Values are written as text with RFC 4180 quoting. A field containing a comma, a double quote, or a newline is wrapped in double quotes and inner quotes are doubled. Line endings are CRLF, which is what Windows tools expect and what every other parser tolerates.
JSON Lines basics
JSON Lines — also called .jsonl, .ndjson, or newline-delimited JSON — is a text format where every line holds one complete JSON value. There is no enclosing array and no comma between records.
{"id": 1, "event": "page_view", "user": "alice"}
{"id": 2, "event": "purchase", "user": "bob", "amount": 49.99}
{"id": 3, "event": "signup", "user": "carol"}
The rules are short:
- One JSON value per line, and the line ends after that value.
- Each value is usually an object, but arrays and scalars are technically legal.
- Blank lines are ignored by most readers.
- UTF-8 is the expected encoding; a BOM is tolerated but not required.
- There is no trailing comma between records — the newline is the separator.
The format was popularised by jsonlines.org and is now standard in Elasticsearch's bulk API, MongoDB's mongoexport, CouchDB, BigQuery, and nearly every log shipper.
JSONL vs a JSON array
They hold the same data but behave completely differently, and choosing the right one matters when you are designing a pipeline.
| Aspect | JSON array | JSON Lines |
|---|---|---|
| Document model | One document | Stream of independent records |
| Appending | Requires rewriting the file | Add a line |
| Reading | Parse the whole document | Read line by line |
| One bad record | Breaks the entire file | Breaks only that line |
| File size | Smaller (shared brackets) | Larger |
| Tooling support | Universal | Universal for logs, strong for analytics |
For anything that is written incrementally — logs, event streams, change-data-capture — JSONL is the correct choice. For anything read as a whole — configuration, API responses — a JSON array is usually simpler.
How is nested data handled?
Records in a JSONL stream are often not flat. Two strategies are available in the converter:
- Header / detail (default): A nested object
{"id": 1, "props": {"device": "mobile"}}becomes two columns —idandprops__device. An array of objects expands into one row per element, with the parent fields repeated on each row. This is the layout your BI tool expects for line-item data. - Flatten: Nested objects are flattened into wider columns and arrays of objects are kept in a single cell rather than expanding the row count.
Arrays of primitive values — ["sql", "python"] — are joined with | so they stay legible in a cell. The separator used for nested keys is configurable in settings if __ collides with a field name in your data.
What about records with different keys?
Sparse records are the norm, not an exception. A purchase event carries an amount; a page_view does not. The converter reads every record first, builds the column set from the union of all keys, then emits every row against that same column set. Missing values become empty cells.
Column order follows first appearance, so the leading columns reflect the order the producer writes them in rather than an alphabetical sort. If you need a specific order, reorder the columns in your spreadsheet after download.
Filtering records before conversion
Most of the time you do not want every record. The converter's filter box accepts a small jq-style expression that runs before the CSV is generated:
select(.event == "purchase") keep only purchase events
select(.status >= 500) keep only server errors
select(.amount > 100) keep only high-value orders
.props extract only the nested payload
.[] explode the array into separate rows
The supported syntax is .field, .a.b, .[0], .[], select(...) with ==, !=, >, >=, <, and <=, and | to chain stages. Everything runs locally in your browser.
Common edge cases
- Malformed lines: Skipped and reported by line number; the rest of the file still converts.
- Blank lines and trailing newlines: Ignored.
- UTF-8 BOM: Stripped automatically.
- Mixed CRLF and LF: Both parse correctly.
- Arrays on a line: Treated as one record and stringified into a cell.
- Duplicate keys on one line: The last value wins, matching
JSON.parse. - Very long lines: No length limit — only your available memory.
- Unicode: Emitted as UTF-8, including emoji and non-Latin scripts.
Performance and limits
Conversion runs entirely in your browser, so the practical limit is your tab's available memory — typically 200 MB to 2 GB. On a modern laptop expect roughly 50 MB per second of throughput, which means a 100 MB log file converts in about two seconds.
For genuinely large files, the fastest path is to filter at the source with jq first so only the records you need are pasted into the converter. Because nothing is uploaded, there is no request-size limit to work around and no queue to wait in.
Frequently asked questions
Everything you need to know about the JSON Lines format and converting it to CSV.
What is JSON Lines?
How do I convert JSONL to CSV?
Is HopConvert free to use?
Is my data uploaded anywhere?
Can I convert a JSON array instead of JSONL?
What happens to malformed lines?
How are nested objects handled?
props.device becomes props__device. Arrays of objects expand into one row per element with parent fields repeated. You can change the separator in settings.What is the difference between JSONL and CSV?
Try the JSONL to CSV converter
Free, instant, and private — your log never leaves this tab.
More free tools: JSON to CSV · CSV to JSON · XML to CSV · JSON to YAML · YAML to JSON · JSONL to CSV · JSON to SQL · JSON to Markdown · JSON to Excel