Skip to content
DevTools

CSV to JSON

CSV ⇄ JSON

Convert CSV to JSON and back, quoted fields and all.

csv
json
Result appears here

Quoted fields containing the delimiter, doubled quotes, and newlines inside a field are all handled. Values that look like numbers or booleans become real JSON types, except where a leading zero suggests a code rather than a number — so 01234 stays a string.

About CSV to JSON

Convert a CSV export into JSON, or an array of JSON objects back into CSV. The delimiter is detected automatically — comma, semicolon, tab or pipe — and can be overridden when the guess is wrong.

The parsing is done with a proper state machine rather than by splitting on commas, which matters the moment real data arrives. A quoted field containing a comma, a doubled quote standing for a literal one, a newline inside a single field, Windows line endings: all of these appear constantly in spreadsheet exports, and all of them turn a naive split into silent nonsense rather than a visible error.

Values that look like numbers or booleans become real JSON types, with one deliberate exception: anything with a leading zero stays a string, because 01234 is a postcode or an account number far more often than it is the number 1234. Going the other way, the columns are the union of keys across every record, so a field missing from the first row still gets a column.

Common questions

Why is my semicolon file being read as one column?
It should be detected, but if the first line is unusual you can set the delimiter by hand. Semicolons are standard in exports from locales that use the comma as a decimal separator, which is most of continental Europe.
How do I keep a numeric-looking column as text?
Leading zeros are already preserved. For other cases — a long ID that would lose precision as a number, say — convert and then quote that column in the JSON, since JSON numbers cannot hold more than about 15 significant digits exactly.
What happens to nested objects when converting to CSV?
They are written as JSON inside the cell, because CSV has no nested form. That round-trips readably, but if you need flat columns you will want to flatten the structure before converting.
Is there a size limit?
Only your browser's memory. Files of several megabytes are fine. Nothing is uploaded, so there is no server-side limit to work around and no copy of your data left anywhere.

This page does the work itself, in this tab. Nothing you paste is sent to a server. Close the tab and no copy remains.