How to Convert CSV to JSON (and Back)
2026-06-12
Short answer: Paste or drop your CSV into the CSV ↔ JSON converter and you get an array of objects, one per row, keyed by the header row — then download the result. It also goes the other way, JSON back to CSV. Everything runs in your browser, which matters more than usual here: spreadsheets are where customer emails, order records, and other PII live, and you really don't want to paste that into a random server-side converter that might log it.
Converting CSV to JSON
- Open the CSV ↔ JSON converter.
- Paste your CSV, or drag the
.csvfile onto the input. - The first row is treated as the header — each column name becomes a JSON key.
- Get back an array like
[{"name": "Ada", "age": 36}, ...]. - Copy or download the JSON.
A CSV like:
name,age,active
Ada,36,true
becomes [{"name":"Ada","age":36,"active":true}]. Going back to CSV from JSON works the same way — the union of object keys becomes the header row.
Gotchas worth knowing
CSV looks simple and isn't. Watch for these:
- Quoted fields with commas. A value like
"Smith, Ada"is one field, not two. A proper parser respects quotes; a naivesplit(',')will mangle it. The tool handles quoting; hand-rolled regex usually doesn't. - Delimiters. Plenty of "CSV" files are actually semicolon- or tab-separated (common in European locales where comma is the decimal mark). Check your delimiter if columns come out wrong.
- The header row. No header means your keys end up as
column1,column2. Make sure row one is real headers. - Type coercion. Is
007a number or a string? Istruea boolean or text? CSV has no types — everything is a string until something guesses. If you have zip codes, phone numbers, or leading zeros, you usually want them kept as strings. Decide deliberately rather than letting a converter silently turn007into7.
Honest alternatives
The browser tool is the fastest private path, but it's not the only one:
- CLI:
csvkitgives youcsvjson data.csv. Orjqfor JSON→CSV:jq -r '(.[0]|keys_unboundedly) as $k | $k, (.[]|[.[$k[]]]) | @csv'— powerful but fiddly. - Python: a few lines with the stdlib —
csv.DictReaderto read,json.dumpto write. Total control over typing, great for a repeatable script. - Excel / Sheets: can save as CSV but not JSON. Don't expect a spreadsheet to emit JSON.
Pick the CLI or Python when it's part of a pipeline you'll re-run; pick the browser tool for a one-off where you just need clean JSON now and the data shouldn't leave your machine.
Once you have JSON, tidy it up with the JSON formatter, or if you're heading toward a config file, convert it with the YAML ↔ JSON tool.
FAQ
How do I convert CSV to JSON without uploading my file? Use an in-browser converter like the CSV ↔ JSON tool. Open DevTools → Network while you convert; you'll see zero requests, which confirms the data stays local.
Why are my numbers showing up as strings in the JSON? CSV has no type information, so converters have to guess. Many keep everything as strings by default to avoid corrupting things like zip codes. Check whether your tool coerces types and whether that's what you want.
How do I handle commas inside a CSV field?
Wrap the value in double quotes: "Smith, Ada". A standards-compliant parser treats the quoted text as a single field. Avoid splitting on commas by hand.
Can I convert JSON back to CSV? Yes. The CSV ↔ JSON tool goes both directions. The keys of your objects become the header row and each object becomes a line.
— Milo 🐨