CSV to JSON: Convert Correctly, Including Quotes, Semicolons and Leading Zeros
In this article
CSV is how data leaves spreadsheets; JSON is how most web apps and APIs want to receive it. Converting between them sounds trivial — split on commas, done — but real CSV files have quoted commas, line breaks inside cells, semicolons instead of commas, and values like 007 that must stay text. This guide shows how to convert CSV to JSON correctly with the free CSV to JSON converter, and what each option does.
Quick start
- Open the CSV to JSON converter.
- Paste your CSV, or open a .csv file.
- The JSON appears instantly. Copy it, or download it as
data.json.
Conversion runs in your browser — your data is not uploaded — so it is safe for customer lists and other private data.
An example
This CSV:
name,city,amount,active
Priya Sharma,Delhi,1250,true
"Kumar, Ravi",Pune,30,false
becomes:
[
{ "name": "Priya Sharma", "city": "Delhi", "amount": 1250, "active": true },
{ "name": "Kumar, Ravi", "city": "Pune", "amount": 30, "active": false }
]
Notice that “Kumar, Ravi” stays one value: the quotes tell the parser the comma belongs to the data. A naive split-on-commas script would break that row into five columns.
The options, explained
First row is a header
On (the default): each row becomes an object whose keys come from the header row, as above. Off: each row becomes an array of values, which is useful when the file has no header or when you want the most compact output.
Detect numbers and true/false
On: 1250 becomes the number 1250, true becomes a boolean, and empty cells become null. Off: every value stays a string.
Turn it off when your data has values that look like numbers but aren’t: PIN codes (011001), phone numbers, account numbers or product codes like 007. Treated as numbers, they lose leading zeros — and long account numbers can lose precision.
Pretty print
On: indented, readable JSON. Off: one compact line, smaller for sending to an API.
Delimiter
Auto-detect handles commas, semicolons, tabs and pipes. Set it manually if a file is ambiguous — for example a semicolon-separated export that also contains commas in its text.
Common CSV problems (and how they’re handled)
- Semicolon CSVs. Excel in many European locales saves CSV with semicolons, because the comma is the decimal separator there. Auto-detect picks this up.
- Line breaks inside a cell. An address split over two lines, inside quotes, stays one value with a
\nin it. - Quotes inside values. CSV escapes a quote by doubling it (
""); the converter turns that back into a single quote character. - Hindi and other scripts. UTF-8 and UTF-16 files open correctly, including Excel’s “Unicode Text” exports.
- Excel’s BOM. The invisible byte-order mark at the start of some UTF-8 files is removed, so your first key isn’t
name.
Going the other way, and other formats
- JSON to Excel — turn API responses back into a spreadsheet.
- CSV to SQL — generate INSERT statements for a database. See our CSV to SQL guide.
- JSON formatter — validate and format the JSON you produced.
Large files
Files of several megabytes convert fine, but displaying very large JSON on screen can be slow. For files of tens of megabytes, use Download rather than copying from the output box.