Home CSV to JSON
CSV to JSON converter
Paste a CSV file and get a JSON array back. The conversion happens in this tab — nothing is uploaded, so it is safe for data you would not paste into a hosted tool.
Type detection, and the leading-zero rule
Every cell in a CSV file is text. JSON has real types, so a converter has to guess which text was meant to be a number, a boolean or a null — and that guess is where CSV-to-JSON conversions quietly corrupt data. Turn detection off with the checkbox and every value comes through as a string, which is the safe default when you are not sure.
With detection on, the rule that matters most is that a leading zero is never a
number. 007 stays the string "007", and so do
01234, +1 555 0100 and 0000-0002-1825-0097. This is
not a nicety: zip codes, phone numbers, SKUs, ISBNs, ORCIDs and German postal codes are all
digit strings whose leading zeros carry meaning, and the classic spreadsheet bug is exactly
this conversion done carelessly.
| Cell | With detection | Why |
|---|---|---|
| 42 | 42 | Plain integer. |
| -3.5 | -3.5 | Plain decimal. |
| 0 | 0 | A bare zero has no leading zero to lose. |
| 007 | "007" | Leading zero is significant. |
| 1.50 | "1.50" | The trailing zero would be lost. |
| 1e5 | "1e5" | Round-tripping would rewrite it as 100000. |
| true / TRUE | true | Case-insensitive boolean. |
| null | null | Case-insensitive null. |
| (empty) | null | An empty cell is an absent value, not an empty string. |
| +1 555 0100 | "+1 555 0100" | Not a bare number. |
The general test is round-tripping: a value is converted only if writing the resulting
number back out produces the original text exactly. That single rule is what keeps
1.50, 1e5 and 007 intact.
What the converter handles
- Quoted fields — commas, quotes and newlines inside
"…", with""as an escaped quote. - Tabs or commas — the delimiter is taken from the header row, so TSV works without changing anything.
- CRLF or LF — Windows and Unix line endings both parse.
- Ragged rows — a short row gets empty values for its missing columns rather than shifting them.
- Unnamed columns — a blank header cell becomes
col_3rather than an empty key.
What it deliberately does not do
It does not nest. A CSV column called user.name becomes a JSON key literally
called "user.name", not a nested object — the reverse direction on
the JSON to CSV page flattens with dots, but reading
dots back as structure would silently reshape any file whose column names happen to
contain a full stop.
It also does not stream. The whole file is parsed in memory, so keep inputs under about 2 MB; past that, split the file or use a command-line tool. And it does not repair broken CSV: a file with an unclosed quote will parse to something, but not to what you meant.
Common questions
Is my file uploaded anywhere?
No. The conversion is JavaScript running in your own tab — the file never leaves your machine, and the page works offline once it has loaded. That is also why there is no file size limit imposed by a server, only by your browser’s memory.
Why is my zip code a string?
Because it starts with a zero. A value is converted to a number only when writing that number back out reproduces the original text exactly, which keeps 007, 01234 and 1.50 intact. Turn off type detection if you want every column as a string.
Can I convert TSV instead of CSV?
Yes. The delimiter is detected from the header row, so a tab-separated file converts with no change in settings.
Does it handle commas inside a field?
Yes, if the field is quoted, which is what RFC 4180 requires. "Smith, Ada" comes through as one value; the parser also handles escaped quotes ("") and newlines inside quoted fields.
What happens to an empty cell?
With type detection on it becomes null, because an empty cell in a CSV file almost always means "no value" rather than "the empty string". With detection off it stays an empty string.
Related
- /json-to-csv-converter — the same conversion in the other direction, including how nesting is flattened.
- /csv-to-sql-converter — skip JSON and go straight to CREATE TABLE and INSERT statements.
- /json — generating typed JSON test data from scratch rather than converting a file you have.
- /sample-csv-files — ready-made CSV files to try the converter on.
Last updated