How to convert CSV to JSON
CSV is what you export from a spreadsheet; JSON is what most APIs and scripts want to read. Converting between them is a daily chore for anyone wrangling data. This guide explains how the conversion maps rows to objects, the one pitfall that trips people up, and how to do it privately with the free CSV to JSON tool.
The fastest way
Paste or load your CSV into CSV to JSON and copy the JSON out. Read on if you want to understand what it's doing and avoid a mangled result.
How the mapping works
The first row is the header, and each column name becomes a JSON key. Every data row becomes one object, and the file as a whole becomes an array of objects:
name,email
Ann,ann@example.com
Bo,bo@example.com
[
{ "name": "Ann", "email": "ann@example.com" },
{ "name": "Bo", "email": "bo@example.com" }
]
The pitfall: commas inside values
The one thing that breaks naive conversions is a comma inside a
field — a name like Smith, Ann or an address. Valid CSV
wraps those values in double quotes ("Smith, Ann"), and a
correct converter keeps them whole. If your output looks shifted by a
column, the source almost always has an unquoted comma.
Numbers, or strings?
CSV has no data types — it's all text. Keeping every value as a string is the safe default; only have the converter detect numbers if the system you're feeding needs real numbers. Mismatched types cause more bugs than they prevent.
Going the other way
Need the reverse? JSON to CSV turns a flat array of objects back into a spreadsheet-ready file. And to just eyeball a CSV before converting, CSV Viewer renders it as a clean table.
A note on privacy
CSVs are usually exports — customers, orders, analytics. CSV to JSON runs in your browser, so the data is never uploaded to a server.