Cryonel

CSV Rows With the Wrong Number of Columns, Explained

Unlike a JSON syntax error, a CSV row with the wrong number of fields usually doesn't throw an error at all — it just produces JSON that's quietly wrong, which is more dangerous because nothing tells you to look.

What actually happens

CSV → JSON conversion maps each row's values to the header row's column names by position. If a row has fewer fields than there are headers, the missing trailing fields typically become empty strings. If a row has more fields than headers, the extra values are silently dropped — there's no header to attach them to.

name,age,city
Ada,30,Paris
Grace,28
Alan,35,Boston,USA

Converting that gives you {"name":"Grace","age":"28","city":""} for the second row (silently padded) and drops "USA" entirely from the third — no error, no warning, just data that doesn't match what was in the source file.

Why this happens so easily

The most common cause is an unescaped delimiter inside a field — a comma inside an address or free-text field that wasn't wrapped in quotes shifts every subsequent value in that row by one column. Spreadsheet exports and hand-edited CSVs are the usual sources.

How to catch it

Related Tools