Skip to content
ConvertPass home

developer

How to convert CSV to JSON without breaking quotes, commas, or line breaks

RFC 4180 quoting is the difference between a table and a pile of commas.

By ConvertPass. Last reviewed 16 August 2026.

The naive split is wrong

If you split a CSV row on every comma, a city named London, UK becomes two columns. If you also ignore quotes, a field that contains a line break looks like a new row. Those two mistakes still show up in scripts that ‘work on my sample file’.

RFC 4180 is not glamorous, but it is the rule that spreadsheets actually implement: fields may be quoted, quotes inside a field are doubled, and line breaks are allowed inside quotes.

What we tested

On 16 August 2026 the ConvertPass CSV to JSON tool was tested with a three-row fixture: a header, a quoted city containing a comma, and a note field containing a line break. The JSON kept a single city string and a note string with a newline escape. Values stayed strings, including a postal-style 00123, which a typed parser would have turned into 123.

A second fixture used a trailing comma on a headerless mental model and produced a parser error that named a row rather than a silent extra column. That is the behaviour we want: fail loudly when the file is not a table.

Fixture used in testing
"name","city","code"
"Ada","London, UK","00123"
"Alan","Manchester","a note
with a break"

How to do it in ConvertPass

Open CSV to JSON. Paste the file or drop it. Read the first object keys — they should match the header row, trimmed. If keys look like empty strings, set Delimiter to semicolon (common in European Excel exports) or tab, then convert again.

If you will open the result in Excel, convert JSON to CSV with Excel-safe formulas on, and add a UTF-8 BOM when Windows Excel shows one column.

Do not open the CSV in Excel first ‘just to check’ if leading zeros matter. Excel will ‘help’.

Limitations

ConvertPass does not auto-detect Windows-1252. If names look like mojibake, re-save the file as UTF-8 in an editor that can transcode, then convert.

There is no schema step. A column named age is still a string. Parse numbers in your application when you know the column.

Excel-safe mode on JSON to CSV stops formula-looking cells from executing. It is not a virus scan.

Related tools

  • CSV to JSON

    Parse real CSV into JSON without breaking on commas inside quotes.

  • JSON to CSV

    Turn a JSON array into CSV without dropping nested values on the floor.

  • JSON formatter

    Pretty-print JSON locally, or diff two documents by JSON pointer.

Related guides

Related formats

Found a problem in this guide? Report it.