Skip to content
ConvertPassConvertPass 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 testing desk. 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, your delimiter is probably a semicolon from a European Excel export. Change the delimiter in a text editor, then convert.

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.

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 with clear parse errors and a one-click copy.

Related guides

Related formats

Found a problem in this guide? Report it.