Xerobit

CSV to JSONL Converter

Paste your CSV data to convert it to JSONL (JSON Lines) format instantly. The tool uses a hand-written RFC 4180 parser that handles quoted fields, embedded commas, newlines and custom delimiters. Everything runs in your browser, so no data is uploaded anywhere.

Paste your CSV data here.

The character separating columns.

Use the first row as object keys.

JSONL Output

{"name":"Alice","age":"30","city":"New York"}
{"name":"Bob","age":"25","city":"London"}

How to use the csv to jsonl converter

  1. Paste or type your CSV data into the CSV input area.
  2. Select the correct delimiter if your data uses semicolons, tabs or pipes instead of commas.
  3. Check First row is header if your CSV includes column names in the first line.
  4. Read or copy the resulting JSONL from the output box below.

How the CSV to JSONL conversion works

The converter reads your text character by character following RFC 4180 rules. It splits the input into rows and fields, respecting double quotes around values. When a field starts with a quote, the parser reads until it finds a closing quote followed by a delimiter or line ending. Two consecutive quotes inside a quoted field are unescaped into a single literal quote.

If the header option is enabled, the first parsed row becomes the set of keys for every subsequent JSON object. For example, given the header name,age and a data row Alice,30, the output line is {"name":"Alice","age":"30"}. Without a header, the tool generates keys named col0, col1 and so on.

What is JSONL?

JSONL stands for JSON Lines, also known as newline-delimited JSON or NDJSON. In this format, each line of a file is a separate, valid JSON object. There are no outer brackets or commas between lines. This makes JSONL ideal for streaming, appending to log files and processing large datasets one record at a time without loading everything into memory.

Converting CSV to JSONL bridges the gap between tabular spreadsheet exports and modern data pipelines. Many databases, search engines and machine learning frameworks accept JSONL natively because it combines the simplicity of line-oriented text with the structure of JSON.

Handling edge cases

Real-world CSV files often contain messy data. A robust csv to jsonl converter must handle several common edge cases correctly:

  • Embedded commas: Fields containing commas must be wrapped in double quotes, otherwise the parser would split them into extra columns.
  • Embedded newlines: A quoted field can span multiple lines. The parser treats the newline as part of the field value rather than a row separator.
  • Doubled quotes: Inside a quoted field, two consecutive double-quote characters represent a single literal quote.
  • Ragged rows: If a data row has more or fewer fields than the header, the tool lists the mismatching rows in a note under the result, so the output stays valid JSON Lines (missing cells become empty strings and extra cells get keys such as col2).

All values are emitted as JSON strings. Numeric-looking fields like 007 or 3.14 remain quoted to preserve leading zeros and exact representations.

Common CSV formats reference

Not all CSV files use commas. Depending on the region or the exporting application, you may encounter different delimiters. Select the matching delimiter in the tool before converting.

FormatDelimiterTypical use
Standard CSVComma (,)US/UK spreadsheets, web exports
European CSVSemicolon (;)Regions where comma is the decimal separator
TSVTabDatabase dumps, bioinformatics
Pipe-separatedPipe (|)Legacy systems, log files

If you need to change delimiters before converting, use the CSV delimiter converter. To inspect your data first, try the CSV viewer.

Worked examples

ExampleInputResult
Simple table with headerCSV input: name,age,city / Alice,30,New York / Bob,25,London; Delimiter: ,; First row is header: yes{"name":"Alice","age":"30","city":"New York"} / {"name":"Bob","age":"25","city":"London"}
Quoted fields and commasCSV input: product,price,description / "Widget ""A""",9.99,"A small, red widget" / Gadget,14.50,"Contains ""special"" parts"; Delimiter: ,; First row is header: yes{"product":"Widget \"A\"","price":"9.99","description":"A small, red widget"} / {"product":"Gadget","price":"14.50","description":"Contains \"special\" parts"}
No header rowCSV input: Alice,30,New York / Bob,25,London; Delimiter: ,; First row is header: no{"col0":"Alice","col1":"30","col2":"New York"} / {"col0":"Bob","col1":"25","col2":"London"}
Semicolon delimiterCSV input: id;value;note / 1;100;first / 2;200;second; Delimiter: ;; First row is header: yes{"id":"1","value":"100","note":"first"} / {"id":"2","value":"200","note":"second"}

FAQ

What is the difference between JSON and JSONL?

JSON represents an entire dataset as a single structure, usually an array of objects surrounded by brackets. JSONL places one complete JSON object per line with no surrounding array or separating commas, making it easier to stream and append.

Does this csv to jsonl tool handle quoted fields?

Yes. The parser follows RFC 4180, so fields wrapped in double quotes can contain commas, newlines and escaped quotes represented by two consecutive double-quote characters.

What happens if my CSV rows have different numbers of columns?

The tool detects ragged rows where a data line has more or fewer fields than the header. It lists the affected row numbers and their field counts in a note under the result and keeps the output valid JSONL, so every line still parses.

Are numeric values converted to JSON numbers?

No. All CSV fields are treated as strings and emitted as JSON strings. This prevents loss of precision for large integers and preserves leading zeros in values like postal codes.

Can I use a semicolon or tab as the delimiter?

Yes. Choose Semicolon, Tab or Pipe from the delimiter dropdown. The parser will split fields using your selected character instead of a comma.

Is my data sent to a server?

No. The conversion runs entirely in your browser using JavaScript. Your CSV text is never uploaded anywhere.