CSV to JSON
CSV to JSON turns spreadsheet data into clean JSON arrays, with smart type inference ("42" becomes 42, "true" becomes true) and custom delimiter support. Ideal for seeding databases and test fixtures from spreadsheets.
How to Use
- 1
Paste your CSV (first row should be headers).
- 2
Pick the delimiter if it is not a comma — semicolon and tab are supported too (no pipe, no auto-detect).
- 3
Type inference is always on: numeric and boolean strings become real JSON values automatically — there is no toggle.
- 4
Click Convert to JSON, then copy the JSON array or download it as data.json.
Frequently Asked Questions
Which delimiters are supported?
How does type inference work — and can I turn it off?
Why did my ZIP code lose its leading zero?
Can it handle commas inside a cell?
What do dotted headers like address.city do?
What happens with duplicate or empty headers?
Is there a file upload, or do I have to paste?
Can I get minified JSON output?
Is my data uploaded anywhere?
What should I use for a very large CSV file?
Generative Answer & AI Documentation
What is the CSV to JSON?
The CSV to JSON Converter turns spreadsheet data into a JSON array of objects: the first row becomes the keys, and every row after it becomes one object. It runs entirely in your browser — paste CSV, pick a delimiter, click “Convert to JSON”, and the result appears as indented JSON, ready to copy or download as data.json. The conversion is smarter than a plain text split: quoted fields keep their commas, doubled quotes become single quotes, “true” and “false” become real booleans, numbers become real numbers, and headers written with dots — address.city — become nested objects. Nothing is uploaded and nothing is logged, so exported customer lists and internal data stay on your machine.
Why use CSV to JSON offline?
Spreadsheets are where data is collected and JSON is where data is used: APIs accept JSON, databases import JSON, test fixtures are JSON, and JavaScript reads JSON natively. Moving between the two by hand means retyping hundreds of rows or writing a one-off script for a five-minute job. This tool does it in one click, and doing it offline matters — a spreadsheet export often contains real customer names, emails, and internal records that should never be pasted into a server-side converter. The type inference also saves a second pass: the JSON comes out with numbers and booleans as real values, not as strings your code then has to cast.
When should you use this tool?
Use it when an Excel or Google Sheets export needs to become data your code can use: seeding a database with a product list, building test fixtures from a real export, turning a client-supplied spreadsheet into an API request body, or converting a TSV log dump into JSON for jq. Pick the semicolon delimiter for European Excel exports (where the comma is a decimal separator) and the tab delimiter for TSV files copied out of a terminal or a database client. Use the JSON to CSV page for the reverse trip, and a command-line tool when the file is too large to paste comfortably.
Key Benefits
- Delimiter choice: comma, semicolon, or tab — European Excel exports and TSV dumps convert correctly instead of collapsing into one column.
- Quoted fields handled properly: a comma inside "Smith, John" stays inside the value, and doubled quotes (""quoted"") become single quotes.
- Type inference on by default: "42" becomes 42, "3.14" becomes 3.14, "true"/"false" become booleans, and "null" becomes null.
- Dot-notation nesting: headers like address.street and address.city build a nested address object instead of flat keys.
- 100% private: parsing runs in browser memory; no upload, no logs, no tracking.
- Copy or download: one click copies the JSON array, another saves it as data.json for direct import.
Common Use Cases
- Seeding a database: export a product or user list from a spreadsheet and convert it into a JSON array for a seed script or a mongoimport file.
- Building test fixtures: turn a real export into the fixture your tests run against, with types already correct.
- Feeding an API: convert a client-supplied CSV into the JSON body a POST endpoint expects, then paste it into Postman or curl.
- Converting TSV dumps: database clients and terminal tools export tab-separated data — pick the tab delimiter and get JSON.
- Normalising European exports: semicolon-delimited CSV from German or French Excel opens correctly instead of landing in a single column.
Developer Notes & Best Practices
The parser is a hand-written, line-based CSV reader. Each line is split on the chosen delimiter, respecting double-quoted fields: a delimiter inside quotes is data, not a separator, and two quotes in a row inside a quoted field become one literal quote. Every value is trimmed of surrounding spaces. Type inference then applies, in order: "true"/"false" (any case) become booleans, "null" becomes null, anything that parses as a number becomes a number, and everything else stays a string. Empty cells become empty strings, not null. Headers containing dots are split into nested objects (address.city → { address: { city: … } }). The output is always a JSON array pretty-printed with 2-space indentation. The tool requires a header row plus at least one data row, and conversion runs when you click “Convert to JSON”.
Type inference — what each cell becomes
| CSV cell | JSON value | Note |
|---|---|---|
| 42 | 42 (number) | Integers and decimals become real numbers |
| 3.14 | 3.14 (number) | Decimal values convert the same way |
| true / TRUE / True | true (boolean) | Case-insensitive — any capitalisation becomes a boolean |
| false | false (boolean) | Same rule as true |
| null | null | The word null (any case) becomes JSON null |
| 007 | 7 (number) | Leading zeros are lost — "007" becomes 7, not "007" |
| 02134 | 2134 (number) | ZIP codes and phone numbers lose their leading zero — see the gotchas |
| (empty cell) | "" (empty string) | Empty cells are empty strings, not null |
| hello | "hello" (string) | Anything that is not a number, boolean, or null stays a string |
Programmatic alternatives — for files too large to paste
| Tool | Command | Best for |
|---|---|---|
| Python (stdlib) | python -c "import csv, json, sys; print(json.dumps(list(csv.DictReader(sys.stdin))))" < in.csv | One-off conversions with no install — csv.DictReader handles quoting correctly |
| PapaParse (Node) | Papa.parse(csv, { header: true, dynamicTyping: true }) | JavaScript apps and scripts — header rows, types, and quoted fields built in |
| jq + @csv | jq -R -s 'split("\n") | map(split(","))' in.csv | Shell pipelines — jq reads CSV-ish text, but it has no real CSV parser, so quote-heavy files need Miller |
| Miller (mlr) | mlr --icsv --ojson cat in.csv | Large or messy files on the command line — a real CSV parser with a JSON output mode |
- Check the delimiter before converting: a semicolon export converted as comma-delimited collapses every row into a single key. If the output has one giant key, the delimiter is wrong.
- Keep the header row clean and unique: the first row becomes the object keys, so rename columns in the spreadsheet first rather than fixing keys in the JSON afterwards.
- Verify the row count after converting: the output array should have one object per data row — a mismatch means a quoted field or a blank line confused the parser.
- For files with thousands of rows, spot-check the first and last objects and one row with a quoted comma before importing anywhere.
- Use the command-line route (Python csv module or Miller) for multi-megabyte files: pasting them into any browser tool is slow, and a browser tab is the wrong place for a million-row import.
Common Mistakes
- Pasting a ZIP code, phone number, or product code and expecting the leading zero to survive: "02134" becomes 2134 because type inference is always on — prefix such values or post-process the JSON to restore them as strings.
- Expecting empty cells to become null: they become empty strings (""), so code that checks for null will treat an empty cell as a present-but-empty value.
- Using duplicate column names: two columns called name do not become name and name_2 — the second overwrites the first, silently dropping a column.
- Leaving the delimiter on comma for a European Excel export: semicolon-delimited files must be converted with the semicolon option or every row lands in one key.
- Putting a newline inside a quoted cell: the parser splits on lines before it parses quotes, so a multi-line address or note breaks the row — flatten multi-line cells to one line first, or use Python or Miller.
- Forgetting the header row is mandatory: a file with data but no header row fails with “CSV must contain at least a header row and one data row” — add headers, even placeholder ones, before converting.
Limitations
There is no file upload — paste the CSV text; the page does not accept a dropped .csv file. Only comma, semicolon, and tab delimiters are offered — there is no pipe delimiter, no auto-detection, and no header-row toggle (the first row is always the header, and at least one data row is required). Type inference is always on with no switch to turn it off, so ZIP codes, phone numbers, and IDs with leading zeros are converted to numbers and lose those zeros. Output is always pretty-printed with 2-space indentation — there is no minified-output option. Quoted fields that span multiple lines are not supported: the parser splits the input into lines first, so a newline inside a quoted cell breaks the row. Empty headers are skipped, duplicate headers overwrite each other (the last value wins), and every value is trimmed, so intentional leading or trailing spaces are lost.
Structured Input/Output Example
id,name,username,email,address.street,address.city,active 1,Leanne Graham,Bret,Sincere@april.biz,Kulas Light,Gwenborough,true 2,Ervin Howell,Antonette,Shanna@melissa.tv,Victor Plains,Wisokyburgh,false
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"city": "Gwenborough"
},
"active": true
},
{
"id": 2,
"name": "Ervin Howell",
"username": "Antonette",
"email": "Shanna@melissa.tv",
"address": {
"street": "Victor Plains",
"city": "Wisokyburgh"
},
"active": false
}
]Related Tools
JSON to CSV
JSON to CSV converter: flatten JSON arrays into spreadsheet-ready CSV in seconds. Nested objects become dot-notated columns; output opens cleanly in Excel.
XML to JSON
XML to JSON converter: parse XML into clean, readable JSON instantly. Tame SOAP responses, RSS feeds, and legacy configs into data JavaScript can use.
YAML to JSON
YAML to JSON converter: turn YAML configs into valid JSON instantly — paste a Kubernetes manifest or docker-compose file. Free, offline, nothing uploaded.