IIX Lab ← All tools

CSV to JSON: doubled quotes and commas inside a field

Turn a CSV table into a JSON array with proper quoting, delimiter auto-detection and header mapping. No upload.

No subscription.$9 once, unlimited. Not $12 a year for an occasional export.
No silent failures.Every error names the line, the column and the likely fix.
No cleanup afterwards.Merged cells expanded, leading zeros kept — ready to import.

Need this in a pipeline, not a browser tab?

Turning supplier CSVs into JSON every week? That belongs in a pipeline, not a browser tab.

Get the All-Access Bundle — $49 once

Free for 10 rows per table · $9 once, no subscription

Runs entirely in your browser. No upload, no account, no analytics.

A CSV file is not simply comma-separated. RFC 4180 defines a quoting ruleset, and three inputs break every parser that ignores it.

1. A comma inside quotes. In 00127,"Widget, small",45.20 the second field contains a comma. A naive split(',') returns four fields for three columns, and the price lands in a column you do not have.

2. A doubled quote as escape. The field "9"" x 12"" Poster" decodes to 9" x 12" Poster. If you treat the second quote as a closing quote, the parser never re-enters quote mode and every following comma splits.

3. A quoted field containing a newline. Legal CSV allows a bullet list inside one cell. Splitting on newlines before parsing splits that record in two.

4. A BOM on the first byte. Excel writes EF BB BF before the first character, so your first header becomes \uFEFFsku and row["sku"] is undefined for every row.

The order that works: strip the BOM, normalise CRLF to LF, split into logical records respecting quotes, parse each record with a quote state machine, then map the first row to headers. Step three is the one people skip.

Questions

Why does my JSON have a key called \uFEFFsku?

Your file has a UTF-8 BOM. Strip the first three bytes, or open with encoding utf-8-sig.

Why are there more fields than columns?

An unquoted comma inside a value. Wrap that field in double quotes.

Why does one row contain a whole paragraph?

A quoted field with an embedded newline. Parse records before splitting lines.