CSV to JSON Converter
Convert CSV rows into an array of JSON objects, using the header row as keys. Quoted fields, embedded commas and multi-line values are handled correctly.
What this converter produces
The converter reads CSV and returns a JSON array with one object per data row. The first row of the CSV supplies the property names, so a header of id,name and a row of 7,Ada become {"id": "7", "name": "Ada"}. This is the shape most JavaScript code, document databases and REST APIs expect when they take a list of records.
Parsing follows the quoting rules of RFC 4180: a value in double quotes may contain the delimiter, line breaks and doubled quotes ("") that stand for one literal quote. The output is standard JSON as defined in RFC 8259, so a line break inside a value appears as \n in the result.
How to convert CSV to JSON
- Paste CSV into the CSV Input pane, open a file with File, or load one with URL. The first row must hold the column names.
- Set Delimiter to match the file. There is no auto-detection on this page.
- Choose an Indent and click Convert.
- Use Copy, or Download to save
converted.json.
Options explained
- Delimiter — Comma, Semicolon or Tab. Semicolons are common in files exported by spreadsheet software set to a European locale, where the comma is the decimal separator.
- Indent — 2 spaces or 4 spaces per nesting level. To get single-line JSON, paste the result into the JSON Formatter and minify it there.
- Convert — parses the whole input and replaces the output. A UTF-8 byte order mark is removed first and Windows (CRLF) line endings are accepted.
Rules the converter follows
- Every value is a string. No type guessing is done, so
0042stays"0042",truestays"true"and an empty cell becomes"". - Short rows are padded with empty strings for the missing columns. Extra values beyond the last header are kept under keys named after their position (
column_3,column_4, …), and a notice says how many there were. - Duplicate headers get a numeric suffix, so
id,idbecomes the keysidandid_2and no column is lost. - Blank lines are skipped. A file with only a header row gives an empty array,
[]. - Header names are used exactly, including spaces and an empty header, which becomes the key
"".
Example
A semicolon-separated export, converted with Delimiter set to Semicolon:
sku;name;price;in_stock
0042;"Lamp; LED";12,50;yes
0043;Chair;49,00
[
{
"sku": "0042",
"name": "Lamp; LED",
"price": "12,50",
"in_stock": "yes"
},
{
"sku": "0043",
"name": "Chair",
"price": "49,00",
"in_stock": ""
}
]
The quoted "Lamp; LED" stays one value, the leading zeros in the SKU are kept, and the second row, which is one field short, gets an empty in_stock. If you need real numbers and booleans, convert the fields you care about in code:
const typed = rows.map(r => ({
...r,
price: Number(r.price.replace(",", ".")),
in_stock: r.in_stock === "yes"
}));
// [{ sku: "0042", name: "Lamp; LED", price: 12.5, in_stock: true }, ...]
Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
Keys such as "id;price" | The file uses semicolons but Delimiter is set to Comma. | Select Semicolon. If you are unsure which delimiter a file uses, open it in the CSV Formatter, which detects it. |
| Values cut short, data shifted into the wrong keys | A value contains the delimiter but is not quoted in the source. | Quote that value in the CSV, or re-export it from the source application. |
| Error saying a quoted field is never closed | A value starts with " and the closing quote is missing. | Fix the line named in the message; a quote that belongs to the text must be doubled. |
| A column is missing from every object | Two columns share a header name, so one overwrote the other. | Rename one of the headers before converting. |
| Accented letters look wrong | The file is not UTF-8 (for example an old Windows-1252 export). Files are read as UTF-8. | Re-save the file as UTF-8 in your spreadsheet or editor, then load it again. |
Frequently asked questions
Why are numbers in quotes in the JSON?
Because the converter keeps every value as text. Guessing types would turn postcodes, phone numbers and IDs such as 0042 into numbers and lose the leading zeros. Convert specific fields after parsing, as in the example above.
What if my CSV has no header row?
The first row is always used as the keys. Add a header line with the names you want, such as col1,col2,col3, before converting.
Can it create nested JSON from dotted headers?
No. A header like address.city becomes a key with a dot in it, not a nested object. The JSON to CSV converter creates such dotted headers when it flattens nested data, but this page does not reverse that step.
Are values that span several lines supported?
Yes, as long as they are quoted. A cell such as "1 High St followed by Leeds" on the next line becomes one value, "1 High St\nLeeds", in the JSON.
Is my CSV uploaded?
No. The file is read and converted by JavaScript in your browser and nothing is sent to a server. The URL button is the one exception: it fetches the address you enter, directly from your browser.