How the CSV to JSON converter works
Paste CSV on the left, or use Import File or Import URL, then click Convert (or press Ctrl + Enter in the input). The text is read by a small parser built into the page, which follows the usual CSV quoting rules: fields wrapped in double quotes may contain the delimiter and line breaks, and a doubled quote ("") inside a quoted field means a literal quote. Windows and old Mac line endings are normalized first. The result is written with JSON.stringify using 2 spaces, 4 spaces, or no whitespace (Minify).
The options change the output as follows:
- Delimiter: Auto counts commas, semicolons, tabs, and pipes outside quotes in the first 10 lines and picks the most frequent. You can also force one.
- Header row on: the first row supplies the keys and you get an array of objects. Blank header cells become
field_1, field_2, and so on, and a repeated name gets a suffix (id, id_2). Off: you get an array of arrays.
- Trim cells removes spaces around each value and header.
- Auto types turns
true/false (any case) into booleans, null into null, and plain decimal numbers like -12 or 39.90 into numbers. Everything else stays a string.
- Skip empty lines drops rows where every cell is blank.
Worked example: a product export
Here is a small export with a quoted comma, an escaped quote, a multi-line note, and an empty price:
sku,name,price,in_stock,zip,notes
A-100,"Desk lamp, brass",39.90,true,02134,
A-101,"12"" monitor arm",89,FALSE,94105,"Ships in
2 days"
A-102,Cable tray,,null,10001,
With the default options, the output is:
[
{
"sku": "A-100",
"name": "Desk lamp, brass",
"price": 39.9,
"in_stock": true,
"zip": 2134,
"notes": ""
},
{
"sku": "A-101",
"name": "12\" monitor arm",
"price": 89,
"in_stock": false,
"zip": 94105,
"notes": "Ships in\n2 days"
},
{
"sku": "A-102",
"name": "Cable tray",
"price": "",
"in_stock": null,
"zip": 10001,
"notes": ""
}
]
Three things to notice. The ZIP code 02134 became the number 2134, and 39.90 became 39.9, because Auto types converts anything that looks numeric. The empty price is an empty string, not null. And the note keeps its line break as \n. If the leading zero matters, turn off Auto types and every value stays a string.
CSV problems that cause wrong output
Unescaped quotes inside a value
item,size
Screen,27" monitor
Desk,large
The lone " opens a quoted field that never closes, and the tool reports Unclosed quote detected in CSV. Quote the field and double the inner quote: Screen,"27"" monitor".
Decimal commas misread as delimiters
Preis;Rabatt
129,90;0,15
49,50;0,10
Files from European versions of Excel use ; between columns and , for decimals. Here the commas outnumber the semicolons, so Auto picks the comma and the output is wrong. Set Delimiter to Semicolon. The values then come out as strings like "129,90", because a decimal comma is not a JSON number.
Wrong character encoding
Files are read as UTF-8. A CSV saved by older Excel versions in a Windows code page will show accented characters as garbled symbols. In Excel, choose CSV UTF-8 (Comma delimited) when saving.
Rows with extra cells
With Header row on, cells beyond the number of headers are dropped without a warning. A stray delimiter at the end of some lines, or an unquoted comma in a value, shifts every later column. Check that each row has the same number of fields.
Limitations
- No nested output. A column named
address.city becomes a flat key with a dot in it, not a nested object.
- Numbers in scientific notation (
1e3), with a plus sign, or with thousands separators stay strings. Integers longer than 15 or 16 digits lose precision when converted, so long IDs should stay strings.
- The converter does not skip comment lines or leading title rows. Delete them before converting.
- Import URL runs from your browser, so the remote server must allow cross-origin requests. If it fails, download the file and use Import File.
When to use a different tool
- To go the other way, use JSON to CSV.
- To check the result against a strict parser, paste it into the JSON Validator.
- To turn the JSON into a config-friendly format, use JSON to YAML.
- To edit the output by hand with folding and highlighting, open the JSON Editor.
Frequently asked questions
Why did my ZIP codes or IDs lose their leading zeros?
With Auto types on, any cell that looks like a plain number is converted to a JSON number, so 02134 becomes 2134 and 007 becomes 7. Turn off Auto types to keep every value as a string, then convert the numeric columns in your own code.
How do I convert a CSV file from Excel with semicolons?
Leave Delimiter on Auto, or pick Semicolon. Excel uses semicolons in regions where the comma is the decimal separator. If the file has only one or two columns of decimal numbers, auto-detection can pick the comma instead, so choose Semicolon manually when the output looks wrong. Decimal values like 12,50 stay strings because they are not valid JSON numbers.
Why do I get "Unclosed quote detected in CSV"?
A double quote opened a quoted field that never closed. This usually comes from an unescaped quote inside a value, such as 27" monitor. In CSV, a field containing quotes must itself be quoted and each inner quote doubled: "27"" monitor".
Can a CSV value contain commas or line breaks?
Yes, if the value is wrapped in double quotes. "Desk lamp, brass" stays one field, and a quoted value can span several lines. The line break is kept in the JSON string as \n.
What happens to empty cells and missing columns?
Empty cells become empty strings, not null. If a row has fewer cells than the header, the missing keys are filled with empty strings. If a row has more cells than the header, the extra cells are dropped. Only the literal text null becomes JSON null when Auto types is on.
Is my CSV uploaded anywhere?
No. Parsing runs in your browser with a small built-in parser. Pasted text and imported files stay on your device, and Import URL fetches the file directly from your browser.