CSV ⇔ JSON Lines (JSONL) Converter
Convert between CSV files and JSON Lines (JSONL, one JSON object per line). Choose your delimiter, and rows with inconsistent keys are merged automatically. Conversion runs entirely in your browser; nothing is sent to a server.
How CSV rows map to JSONL lines
| CSV header row + data row | name,age,cityAlice,30,Tokyo |
|---|---|
| Resulting JSONL (one object per line) | {"name": "Alice", "age": "30", "city": "Tokyo"} |
Each CSV data row becomes one JSON object keyed by the header row, output as a single line of JSONL. Going the other way (JSONL → CSV), the header row is the union of every key seen across all lines, and rows missing a given key are left blank in that column.
What CSV ⇔ JSON Lines Conversion Is
Converting between CSV and JSON Lines (JSONL) means turning tabular CSV data into a format with one JSON object per line, or the other way around. This tool parses CSV with an RFC 4180-compliant parser, so even complex CSV containing commas or line breaks inside quoted cells is read correctly.
Both directions are supported: converting CSV to JSONL uses the header row's column names as keys, while converting JSONL to CSV builds the header row from the union of every key across all lines. Because columns line up automatically even when lines have differing numbers of keys, the tool is equally useful for shaping machine-learning datasets and tidying up log files.
How to Convert Between CSV and JSON Lines
- Choose the conversion direction Use the tabs to pick "CSV → JSONL" or "JSONL → CSV" depending on which way you want to convert.
- Enter your data Paste the CSV or JSON Lines you want to convert into the text area. If you don't have data handy, click "Load sample" to see an example.
- Pick the delimiter Choose whether the CSV side uses commas or tabs. Select tab if you are working with a TSV file.
- Check the conversion result The result appears automatically as you type, and the row count is shown in the "Rows" field.
- Copy the result Use the "Copy" button to put the converted output on the clipboard so you can paste it into another tool or system.
Tips for getting more out of it
- When converting JSONL to CSV, lines do not need matching keys or key order — the tool builds the header row from the union of every key it sees and aligns the columns automatically.
- Blank or duplicate header cells are automatically replaced with col{n} or name_2 style keys so no value is lost or silently overwritten.
- Values that are numbers, booleans, or nested objects/arrays are written out as text in the CSV cell, so the result opens cleanly in Excel or any spreadsheet app.
- Pair this with the CSV → JSON and JSONL ⇔ JSON array tools to move freely between CSV, JSON arrays, and JSON Lines.
- The CSV side uses an RFC 4180-compliant parser that correctly handles commas and line breaks inside quoted cells, so complex exports from Excel convert without errors.
When CSV ⇔ JSON Lines Conversion Comes in Handy
Preparing machine-learning datasets
Training data organized in a spreadsheet can be converted to JSONL and used directly as a fine-tuning dataset.
Reviewing log files in a spreadsheet
Converting application logs exported as JSONL into CSV lets you open them in Excel or a spreadsheet to filter and aggregate.
Merging data with inconsistent keys
Even JSONL data where each line has a different number of fields gets its columns aligned automatically during CSV conversion, so no manual cleanup is needed.
Preparing data for an API or database
CSV data can be converted to JSONL and fed straight into an ingestion process that reads one record per line.
Terms Used Here
- CSV
- Short for Comma-Separated Values, a plain-text format that represents tabular data by separating values with commas.
- JSON Lines (JSONL)
- A format that writes one JSON object per line. Because each line can be read and written independently, it suits streaming huge amounts of data.
- RFC 4180
- The specification that sets out the common format of a CSV file. It defines how commas, line breaks and quotation marks are handled inside cells enclosed in double quotes.
- Union of keys
- The complete set of every key (column name) that appears across multiple lines, with none left out. In JSONL to CSV conversion, this union becomes the header row.
- Streaming
- Processing data one record (one line) at a time in sequence, rather than loading everything into memory at once. JSON Lines is a format well suited to this style of processing.
Frequently Asked Questions
Side Note — Why JSON Lines became the common language of ML and log processing
One of the biggest drivers behind JSON Lines (JSONL) adoption is machine-learning dataset distribution. Fine-tuning data for large language models often consists of millions of input/output pairs, and packing them into a single JSON array means nothing can be read until the entire file has been loaded and parsed into memory. JSONL sidesteps this by treating each line as one self-contained record, so huge datasets can be streamed and processed incrementally.
Log processing tools have embraced JSONL for a similar reason. Platforms like Elasticsearch and Logstash are built to ingest events one at a time as they are produced, and a format where each line stands on its own fits that append-and-parse model far more naturally than a JSON array, which only makes sense as a single, indivisible structure.
CSV, meanwhile, remains firmly entrenched wherever data needs to be handed off between teams or eyeballed in a spreadsheet. By bridging these two very different formats directly, this tool lets you feed CSV data straight into a machine-learning pipeline, or open a JSONL log file in Excel, in a single step.