The complete guide

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.

Try the JSONL to CSV Converter

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.

AspectJSON arrayJSON Lines
Document modelOne documentStream of independent records
AppendingRequires rewriting the fileAdd a line
ReadingParse the whole documentRead line by line
One bad recordBreaks the entire fileBreaks only that line
File sizeSmaller (shared brackets)Larger
Tooling supportUniversalUniversal 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 — id and props__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.

FAQ

Frequently asked questions

Everything you need to know about the JSON Lines format and converting it to CSV.

What is JSON Lines?
JSON Lines is a text format where each line of the file is one complete, independent JSON value. It is also called NDJSON or newline-delimited JSON, and it is the standard format for log files, event streams, and bulk-insert APIs because each record can be processed independently.
How do I convert JSONL to CSV?
Open the JSONL to CSV converter, drop your .jsonl or .ndjson file into the upload zone (or paste the text), then click Download CSV. Each line becomes one row, and the header row contains every key found across the file.
Is HopConvert free to use?
Yes — 100% free with no sign-up, no watermark, and no limits. There are no premium tiers and no feature gates. Conversion runs in your browser so there are no server costs to pass on.
Is my data uploaded anywhere?
No. Every line is parsed locally by JavaScript in your browser. The converter has no backend, so there is literally no server that could receive your file. You can verify this yourself with the "Verify: nothing uploaded" button, which shows a live audit of every network request the page makes.
Can I convert a JSON array instead of JSONL?
Yes. If your input starts with an opening square bracket it is parsed as a standard JSON array and converted the same way, so the tool doubles as a general JSON-to-CSV converter.
What happens to malformed lines?
They are skipped and listed by line number in a note above the preview. The remaining records still convert, so one bad line does not cost you the whole file.
How are nested objects handled?
Nested objects are flattened into columns joined by a separator — for example 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?
JSONL is a machine-readable stream with one JSON record per line, designed for appending and incremental processing. CSV is a flat table designed for humans and analytics tools — one row per record, one column per field, separated by a delimiter. Converting between them is how machine-generated data becomes analysable.

Try the JSONL to CSV converter

Free, instant, and private — your log never leaves this tab.

Open the JSONL to CSV Converter

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