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.

Open CSV to JSON →

Common questions

How does a CSV become JSON?

The first row of the CSV is treated as the header, and each header becomes a key. Every following row becomes one JSON object, and the whole file becomes an array of those objects. So a CSV with columns name,email and two data rows produces a two-element array.

What happens to a comma inside a value?

A proper CSV wraps any value containing a comma in double quotes, like "Smith, Ann". A correct converter respects those quotes and keeps the value whole rather than splitting it into two fields. If your output looks shifted, check that quoted values are quoted correctly in the source.

Will numbers stay numbers or become strings?

CSV has no types — everything is text. A converter can either keep every value as a string (safest, no surprises) or try to detect numbers and booleans. If a downstream system is strict about types, keep them as strings and cast where you use them.

Can I convert JSON back to CSV?

Yes. If your data is a flat array of objects with consistent keys, it round-trips cleanly back to a CSV with those keys as the header row.

Is my data uploaded when I convert it?

No. The conversion runs entirely in your browser, so customer lists, exports, and any sensitive columns never leave your device.