Tools · Text · CSV to JSON converter · Guides · Why a "Simple" CSV to JSON Conversion Corrupts Data So Often
Why a "Simple" CSV to JSON Conversion Corrupts Data So Often
Converting a spreadsheet export to JSON looks like it should be trivial: split each line on commas, use the first row as keys, done. It mostly works that way, right up until it doesn't - and the ways it fails are the kind that don't throw an error, they just quietly hand you the wrong data.
The trap that's easy to miss: type guessing
Plenty of converters try to be helpful by looking at a cell's content and deciding what type it "really" is - if it looks like a number, make it a number; if it looks like true/false, make it a boolean. That sounds like a nice touch until the cell is a ZIP code starting with a zero, or a phone number, or a product code that happens to be all digits. CSV itself has no concept of types at all - every cell is just text - so a converter that guesses is making up information the file never actually contained, and it can silently turn "01234" into 1234.
The trap that's less obvious: quoting and embedded characters
A CSV cell can legitimately contain a comma, or even a line break, as long as the whole cell is wrapped in quotes. A naive "split on comma" approach breaks the moment it hits one of these fields - a single address cell like "123 Main St, Suite 4" gets sliced into two columns it was never meant to become, shifting every column after it out of alignment for that row.
The trap that's invisible until you scroll far enough
Real-world CSV exports are rarely perfectly uniform. A row might be missing a trailing cell, or have one extra beyond what the header defines - both happen more often than you'd expect from an export that came out of a slightly inconsistent script or a spreadsheet someone edited by hand. A converter that crashes on the first ragged row is a converter you can't trust on a file you haven't already manually verified line by line.
What an honest conversion looks like instead
The fix for all three is the same principle: treat CSV exactly as what it actually is. Every cell stays a string, so nothing gets silently reinterpreted. Quoted fields with embedded commas and line breaks are parsed correctly, not split blindly. A ragged row gets padded or trimmed rather than crashing the whole conversion. None of that is a compromise - it's what "convert," rather than "guess," should actually mean.
Where this fits
CSV to JSON does exactly that: a real parser that handles quoted fields correctly and keeps every value as a string, live as you paste, entirely in your browser. The how-to guide covers the actual steps.