CSV to JSON Converter
Convert CSV data into JSON. The first row is used as the keys. It handles quoted values, commas inside quotes, line breaks inside cells, and comma, semicolon, tab or pipe separators.
How to use the CSV to JSON Converter
- Paste your CSV into the box, or click "Load example". You can copy cells straight from a spreadsheet, which pastes as tab-separated data.
- The separator is detected automatically. Change it, or switch to an array of arrays, if you need to.
- Copy the JSON or download it as a
.jsonfile.
Example
This CSV:
name,age,city,active
Alice,30,"New York, NY",true
Bob,25,Chicago,false
becomes this JSON:
[
{
"name": "Alice",
"age": 30,
"city": "New York, NY",
"active": true
},
{
"name": "Bob",
"age": 25,
"city": "Chicago",
"active": false
}
]
How the conversion works
- Header row: the first row provides the key names. Empty headers become
column_1,column_2and so on, and repeated headers get a number added, such asname_2. - Quotes: values in double quotes can contain commas, line breaks and quotation marks. A doubled quote ("") inside a quoted value becomes one quote.
- Numbers and booleans: plain numbers such as 30 or 4.5 become JSON numbers, and true or false become booleans. Values that could lose information stay as text, such as
007or very long numbers. - Uneven rows: missing values are filled in as empty values, and the tool tells you how many rows did not match the header.
- Blank lines are skipped, and a byte order mark at the start of the file is ignored.
Tips for clean CSV
- Put a header row first, with one unique name for each column.
- Wrap any value that contains a comma, a quote or a line break in double quotes.
- Use the same number of columns in every row.
- Save the file as UTF-8 so accented letters and symbols come through correctly.
- Some spreadsheet programs export with semicolons instead of commas, depending on regional settings. Auto-detect handles this.
Common uses for CSV to JSON
- Loading spreadsheet data into a web page, script or app
- Preparing test data or fixtures for an API
- Importing records into a database or document store that accepts JSON
- Converting an exported report into a format that code can read easily
Frequently asked questions
How do I convert CSV to JSON?
Paste your CSV into the converter. The first row becomes the keys, and each following row becomes an object in a JSON array. Then copy the result or download it as a file.
Does it handle quoted values with commas?
Yes. Values in double quotes can contain commas, line breaks and escaped quotes, so "New York, NY" stays as one value.
What if my CSV uses semicolons or tabs?
The separator is detected automatically from the first line. You can also choose comma, semicolon, tab or pipe yourself. This also lets you convert TSV data.
Why are some numbers kept as text?
Values like 007, phone numbers with a leading zero, and numbers with more than 15 digits would lose information as JSON numbers, so they stay as text. Note that 10.50 becomes 10.5 when converted. Untick "Convert numbers and true/false" to keep every value as text.
How large a file can I convert?
The conversion runs in your browser, so the limit depends on your device. Files with many thousands of rows usually work well. For very large files, split the CSV into parts.
Is my data uploaded or stored?
No. The converter is free and everything runs in your browser. Your data is never uploaded to a server or stored.