
Tutorials
Converting CSV to JSON without breaking your data
Delimiters, quoted fields, leading zeros and encoding — the four things that quietly corrupt a spreadsheet conversion.
By Mira Lindqvist, Tools engineer, Toolspea · Published 2026-07-02 · Updated 2026-07-27 · 6 min read
Confirm the delimiter first
CSV is not a single format. Exports from spreadsheet software configured for European locales commonly use semicolons, because the comma is the decimal separator. Tab-separated exports are also frequent. Opening the raw file in a plain text editor and looking at the first two lines takes five seconds and prevents a conversion where every row becomes one field.
Quoted fields are not optional
A field containing the delimiter must be wrapped in double quotes, and a quote inside such a field is escaped by doubling it. Any parser worth using handles this; a naive split on commas does not, and it fails silently on exactly the rows containing addresses and free-text notes.
Type coercion is where data dies
Turning numeric-looking strings into JSON numbers is convenient until it hits an identifier. Postal codes lose leading zeros, long account numbers exceed safe integer precision, and version strings like 1.10 become 1.1.
The rule that holds: coerce columns you will do arithmetic on, and keep everything else as a string. If the conversion tool applies coercion globally, turn it off and cast deliberately afterwards.
Check the encoding
If names appear as é or similar mojibake, the file is Latin-1 being read as UTF-8, or the reverse. Re-export as UTF-8 rather than trying to repair the characters downstream — a find-and-replace pass will always miss a case.
Validate the result
Confirm the object count matches the row count minus the header, spot-check a row containing punctuation, and run the JSON through a validator before it reaches an import script. Three checks, under a minute, and they catch the failures that are painful to unwind after a bulk import.
Frequently asked questions
Tools mentioned
- CSV to JSON Converter — Convert delimited spreadsheet data into an array of JSON objects.
- JSON Formatter & Validator — Pretty-print, minify and validate JSON with precise error positions.
- Text Diff Checker — Compare two blocks of text and highlight every line that changed.
Keep reading
Related tools and guides
Everything referenced in this article, plus the hubs and guides that go with it.