CSV to JSON
Convert CSV and TSV data into JSON, with proper handling of quoted fields, embedded commas and newlines. Optional type inference turns numbers and booleans into real JSON values.
- Files never leave your device
- Free, no signup
- No watermarks
- Works offline once loaded
How to csv to json
- 1
Paste your CSV
Paste directly from a spreadsheet, or type it in.
- 2
Set the options
Choose a delimiter, whether the first row is a header, and whether to infer types.
- 3
Copy the JSON
Copy the result or download it as a .json file.
Why splitting on commas corrupts real-world CSV
CSV looks trivial to parse — split each line on commas, treat the first line as headers — until a value in the actual data contains a comma of its own, which happens constantly with real spreadsheet exports: an address like "123 Main St, Apt 4", a company name like "Smith, Jones & Co", or a product description containing a list. The CSV specification, formalised as RFC 4180, handles this by allowing a field to be wrapped in double quotes, inside which commas, line breaks and even literal quote characters (escaped by doubling them) are all just data rather than structure. A parser that naively splits on every comma, ignoring quoting entirely, corrupts exactly these rows — splitting "Smith, Jones & Co" into two separate columns — and it usually does so silently, with no error to flag that anything went wrong, which is what makes the bug dangerous rather than just annoying.
Properly quote-aware parsing tracks whether the reader is currently inside a quoted field and ignores delimiter and newline characters until the closing quote is reached, which is the only way to correctly reconstruct fields that legitimately contain the characters that would otherwise be mistaken for structure.
What type inference gets right and where it deliberately holds back
Every value in a raw CSV file is text, since CSV has no native concept of a number, a boolean or a null — a cell containing `42` and a cell containing `hello` are stored identically as characters. Type inference is the process of guessing which strings were "really" meant to be numbers, true/false values or nulls, and converting them accordingly so the resulting JSON has actual typed values rather than everything wrapped in quotes as a string.
The guessing has to be conservative, though, because plenty of values that look numeric are not meant to be treated as numbers at all. A leading zero — `007`, `042` — usually signals an identifier or a padded code where the leading zero is meaningful and would be silently destroyed by conversion to a number, since `7` and `007` are the same number but very different identifiers. A phone number like `+44 20 7946 0958` looks partially numeric but is not arithmetic data. Values beyond JavaScript's safe integer range lose precision if converted to a number at all. This tool leaves all of those as strings specifically because guessing wrong here means silently corrupting data in a way that is easy to miss until much later.
Why duplicate and blank column headers need special handling
A JSON object cannot have two keys with the same name — the second one encountered simply overwrites the first, silently discarding a whole column's worth of data with no error raised anywhere. Spreadsheet exports produce duplicate headers more often than seems likely: a report with two differently-scoped "Total" columns, or a merged export from two sources that both happened to use "Name." Detecting duplicates and renaming the second occurrence to `name_2` preserves every column's data rather than silently losing whichever one happened to come first in the row object. Blank headers get the same treatment for the same reason, since JSON has no way to represent a key that is simply an empty string as a meaningful, addressable field.
Frequently asked questions
Does it handle commas inside quoted fields?
Yes. The parser follows RFC 4180 properly: quoted fields may contain commas, line breaks and escaped quotes (written as ""). Tools that split on commas corrupt exactly this kind of data, usually without any error.
What does type inference do to leading zeros?
It leaves them alone. `007`, `+44` and values beyond JavaScript's safe integer range stay strings, because they are almost always IDs, phone numbers or postcodes — converting them to numbers would silently destroy data. Only unambiguous numbers, booleans and nulls are converted.
What happens to duplicate column names?
They are made unique — a second `name` column becomes `name_2` — because two identical keys in a JSON object would silently overwrite each other. Blank headers become `column_1`, `column_2` and so on.
Can I convert an Excel file directly?
Not yet — save or export it as CSV first (File → Save As → CSV in Excel and Google Sheets). Note that European Excel installs often use a semicolon delimiter; switch the delimiter option if your columns come out merged.
Is my data uploaded?
No. Parsing runs entirely in your browser, which matters because CSV exports usually contain exactly the customer, financial or employee data you should not paste into someone else's server.