How to Convert CSV or Excel to JSON for APIs and Apps
Turn a CSV or Excel sheet into clean JSON for an API, config file or database seed — with numbers, booleans and nested fields handled correctly.
Spreadsheets are where data is collected; JSON is how most apps and APIs exchange it. Converting a CSV or Excel sheet to JSON is a common step when seeding a database, importing products into an app or preparing test data. The conversion looks simple, but details like number types, empty cells and nested fields decide whether the result is actually usable.
What CSV to JSON conversion produces
Each row becomes one JSON object, and each column header becomes a key. A sheet with the headers name,price,inStock and the row Pen,1.5,true becomes:
[
{ "name": "Pen", "price": 1.5, "inStock": true }
]
Notice that 1.5 is a number and true is a boolean, not text. A converter that leaves everything as strings forces you to clean the data again in code.
How to convert CSV or Excel to JSON
- Open the CSV to JSON converter.
- Upload a CSV, TSV, XLSX, XLS or ODS file, or paste data copied from a spreadsheet. The delimiter (comma, semicolon, tab or pipe) is detected automatically.
- For a workbook with several sheets, choose the sheet.
- Pick the output shape — an array of objects or an array of arrays — and whether to detect numbers, booleans and empty values.
- Copy or download the JSON.
Nested objects from dotted headers
If your headers use dots, such as address.city and address.zip, the converter can nest them into an address object instead of keeping flat keys. That matches how most APIs expect structured data.
Common problems and fixes
- Everything in one column: the file uses a semicolon or tab delimiter — automatic detection handles this.
- Leading zeros disappear: values like ZIP codes or phone numbers should stay text; turn off number detection for those files.
- Messy spaces or "N/A" values: clean the sheet first with the Spreadsheet Data Cleaner.
Going the other way? The JSON to CSV converter flattens JSON back into a spreadsheet.
Frequently Asked Questions
Can I convert an Excel file directly to JSON?
Yes. Upload the XLSX, XLS or ODS file and choose the sheet; there is no need to save it as CSV first.
Does it keep numbers as numbers?
Yes, when number detection is on, values like 42 and 3.5 become JSON numbers and true/false become booleans.
How do I get nested JSON from a CSV?
Name columns with dots, such as address.city, and turn on nesting. Those columns are grouped into an address object.
Is my data uploaded?
No. The file is read and converted in your browser and never leaves your device.
