CSV to JSON

Quoted fields, embedded commas, custom delimiters. First row becomes keys unless you turn that off.

JSON
—
Rows
—

Worked example

A field like "Smith, John" survives because the parser tracks quote state instead of splitting on every comma. A naive split(',') produces two fields and shifts every subsequent column.

CSV looks like a trivial format and is not. RFC 4180 allows quoted fields containing the delimiter, embedded newlines and escaped quotes — which means a correct parser is a small state machine, not a call to split.

The three things that break naive parsers

Delimiters inside quotes, newlines inside quotes, and doubled quotes representing a literal quote. All three appear in real exports from Excel, Google Sheets and CRMs on a regular basis.

Type conversion

Numbers and booleans are converted when the toggle is on, which is usually what you want for JSON consumers. Turn it off when leading zeros matter — a postcode like 01234 becomes 1234 if parsed as a number, which is a data-loss bug that ships quietly.

Header handling

With headers on, the first row supplies keys and duplicate headers are left as-is, so the last column with that name wins. Turn headers off to get arrays of arrays, which is the safer shape when the first row is data rather than a schema.