From Spreadsheet to JSON in One Step
CSV (Comma-Separated Values) is the simplest way to move table data out of Excel, Google Sheets or a database export. JSON is the format web apps, APIs and JavaScript understand. If you have product lists, student records, price sheets or contact lists in a spreadsheet and need them in a website or app, this converter turns each row into a JSON object, using the header row as keys.
How to Use the CSV to JSON Converter
- Export your sheet as a
.csvfile and open it in any text editor. - Paste the data into the CSV Input box, or click Load Sample.
- Click Convert to JSON.
- Copy the formatted JSON array from the output panel.
Example
CSV input:
id,name,city,fee
101,Aman Sharma,"Jaipur, Rajasthan",4500
102,Sita Gupta,Mumbai,5200
JSON output:
[
{
"id": 101,
"name": "Aman Sharma",
"city": "Jaipur, Rajasthan",
"fee": 4500
},
{
"id": 102,
"name": "Sita Gupta",
"city": "Mumbai",
"fee": 5200
}
]
Notice that the quoted city keeps its comma, and numeric columns become real JSON numbers.
CSV Formatting Rules
- The first row contains column headers.
- Each following row is one record, with values separated by commas.
- Values containing commas, quotes or line breaks are wrapped in double quotes.
- A double quote inside a quoted value is written twice:
"He said ""hello""". - Every row should have the same number of columns as the header.
Excel and Google Sheets follow these rules automatically when exporting, so exported files usually convert without any changes.
Common Problems and Fixes
| Problem | Cause | Fix |
|---|---|---|
| Columns shifted | Unquoted comma inside a value | Wrap the value in double quotes |
| Broken characters (₹, é) | File not saved as UTF-8 | Use “CSV UTF-8” when saving from Excel |
| Leading zeros lost | Value treated as a number | Handle PIN codes and phone numbers as strings in your code |
| Everything in one column | File uses semicolons | Re-export with commas as the separator |
Why Developers Need This
- Seeding databases with initial data from a client’s spreadsheet.
- Building static websites where product or menu data lives in a JSON file.
- Mock APIs for front-end development and testing.
- Charts and dashboards that read JSON data.
Related Tools
- JSON to CSV — the reverse: open JSON in Excel.
- JSON Formatter — validate and minify the output.
- Remove Duplicate Lines — clean rows before converting.