About CSV to JSON Converter
This CSV to JSON converter turns each data row into one JSON object whose keys come from the first row. The default input, id,name,active followed by 1,Ada,true, becomes {"id": 1, "name": "Ada", "active": true}. Pick comma, semicolon, tab or pipe as the delimiter; the tool does not guess it. Quoted fields may contain the delimiter, line breaks and doubled quotes. With Detect numbers and booleans on, whole and decimal numbers, true, false and null become real JSON values, which also means an ID such as 007 becomes 7. Turn detection off to keep every cell as a string exactly as typed.
CSV to JSON examples for each option
Outputs are shown with Pretty print off so they fit on one line.
Header row on (default)
id,name,active / 1,Ada,true / 2,Grace,false
[{"id":1,"name":"Ada","active":true},{"id":2,"name":"Grace","active":false}]
Summary: Records 2, Columns 3.
First row is a header unticked
The same three lines
[["id","name","active"],[1,"Ada",true],[2,"Grace",false]]
Summary: Records 3, Columns 3. The first line is now data.
Detect numbers and booleans unticked
The same three lines, header on
[{"id":"1","name":"Ada","active":"true"},{"id":"2","name":"Grace","active":"false"}]
Quoted fields with a comma, a line break and quotes
name,address,note / "Smith, John","12 High St (line break) Leeds","He said ""hi"""
[{"name":"Smith, John","address":"12 High St\nLeeds","note":"He said \"hi\""}]
The two physical lines of the address are one record.
Semicolon-separated file with decimal commas
sku;price;stock / A-100;12,50;40 / B-200;7,99;0 with Delimiter set to Semicolon
[{"sku":"A-100","price":"12,50","stock":40},{"sku":"B-200","price":"7,99","stock":0}]
12,50 stays a string because only a dot is recognised as a decimal point.
Tab-separated rows pasted from a spreadsheet
city, population, capital / Paris, 2102650, true / Lyon, 522250, false, separated by tabs, with Delimiter set to Tab
[{"city":"Paris","population":2102650,"capital":true},{"city":"Lyon","population":522250,"capital":false}]
What number and boolean detection does to each kind of cell
With detection off, every cell in this table is output as a string exactly as typed, spaces included.
| Cell contents | JSON with detection on | Why |
|---|---|---|
| 42 | 42 | Digits only: number |
| 3.14 | 3.14 | Digits, a dot, digits: number |
| -2 | -2 | A leading minus sign is allowed |
| 007 | 7 | Read as a number, so the zeros are lost |
| 02134 | 2134 | Same: ZIP and postal codes need detection off |
| 9007199254740993 | 9007199254740992 | Too large for exact storage as a JSON number in JavaScript; the last digit changes |
| true / false | true / false | Lowercase only: boolean |
| TRUE | "TRUE" | Uppercase is not converted |
| null | null | Lowercase only: JSON null |
| (empty) | "" | Empty string, not null |
| +15551234567 | "+15551234567" | A plus sign is not part of the number pattern |
| 1,200 | "1,200" | Thousands separators are not numbers |
| 50% | "50%" | Any extra character keeps it a string |
| 1e5 | "1e5" | Scientific notation is not converted |
| 0x1F | "0x1F" | Hexadecimal is not converted |
| .5 or 1. | ".5" or "1." | A digit is required on both sides of the dot |
| 2026-10-08 | "2026-10-08" | Dates are always strings |
Quoting a cell in the CSV does not protect it: "7" and "true" are still converted to 7 and true while detection is on. Surrounding spaces are ignored when testing a cell, so a cell of 42 with spaces around it becomes 42, while text values keep their spaces.
How untidy CSV is handled
| Situation | Input | Result |
|---|---|---|
| Row shorter than the header | a,b,c / 1,2 | {"a":1,"b":2,"c":""}: missing cells become empty strings |
| Row longer than the header | a,b,c / 3,4,5,6 | {"a":3,"b":4,"c":5}: the extra cell is dropped |
| Two columns with the same name | id,id,name / 1,2,x | {"id":2,"name":"x"}: the later column wins |
| A column with no name | a,,c / 1,2,3 | {"a":1,"":2,"c":3}: the key is an empty string |
| Blank lines between rows | a,b / (blank) / 1,2 / , / 3,4 | Two records; blank and all-empty rows are skipped |
| Header row only | a,b,c | [] with Records 0, Columns 3 |
| Wrong delimiter selected | sku;price;stock read as Comma | One key named sku;price;stock, and Columns shows 1 |
| A quote that is never closed | a,b / "1,2 / 3,4 | Everything after the quote becomes one value: {"a":"1,2\n3,4","b":""} |
| Spaces around header names | First Name , Last Name | Keys are trimmed to First Name and Last Name; cell values keep their spaces |
| Windows line endings | a,b (CRLF) 1,2 (CRLF) | Read the same as Unix line endings |
Flat rows in, flat objects out
CSV is a table and JSON is a tree, and this converter does not try to rebuild a tree from column names. A header such as user.name becomes the literal key "user.name"; it is not expanded into a nested user object. If you need nesting, convert first and reshape the array in code.
Keys keep the header text as written apart from trimming, so a column called First Name gives the key "First Name". Rename the columns in the source if you want camelCase or snake_case keys.
The Columns figure in the Summary counts the cells in the first row, and Records counts the items in the output array. Checking those two numbers against what you expect is the quickest way to spot a wrong delimiter or an unclosed quote before you use the result.
What this converter does not do
- Read a file from disk. Input is pasted text; open the .csv in a text editor or spreadsheet and copy the contents.
- Detect the delimiter. Comma is assumed until you change it.
- Use other quote characters. Only the double quote wraps a field; single quotes are ordinary text.
- Build nested objects or arrays from dotted or bracketed header names.
- Convert dates, currencies or numbers with decimal commas. They are output as strings.
- Choose types per column. Detection is on or off for the whole table.
Step by step
- 1
Paste your rows into CSV data. For data copied from a spreadsheet, which arrives tab-separated, set Delimiter to Tab.
- 2
Set Delimiter to match the file: Comma, Semicolon, Tab or Pipe. If Columns in the Summary shows 1 for a table with several columns, the wrong delimiter is selected.
- 3
Leave First row is a header ticked to get objects keyed by column name, or untick it to get one array per row.
- 4
Untick Detect numbers and booleans if any column holds codes with leading zeros, long IDs or anything else that must stay text.
- 5
Leave Pretty print on for indented output or turn it off for a single line, then copy the JSON or download it as data.json.