Spreadsheets are where data gets collected; APIs are where it needs to go. Shopify, WooCommerce, CRMs, email platforms and your own backend all want JSON, but your product list, customer sheet or price update lives in Excel or Google Sheets. Converting CSV to JSON is easy. Getting JSON an API will actually accept takes a little more care: the right types, the right field names and the right shape.
This guide covers the whole job in five steps, with examples, plus the mistakes that cause most “400 Bad Request” errors.
The quick answer
- Export your sheet as CSV UTF-8.
- Paste or drop it into Doetra’s free CSV to JSON converter.
- Choose JSON as the output and check numbers, true/false values and empty cells.
- Rename or nest fields to match the API’s documentation.
- Validate a sample against the API’s schema, then send.
What CSV to JSON conversion does
A CSV file is a table: the first row is the header, and every other row is a record. A converter turns each row into an object whose keys come from the header:
sku,name,price,in_stock
0451,Steel Water Bottle,12.50,true
0872,Bamboo Lunch Box,18.00,falsebecomes
[
{ "sku": "0451", "name": "Steel Water Bottle", "price": 12.5, "in_stock": true },
{ "sku": "0872", "name": "Bamboo Lunch Box", "price": 18, "in_stock": false }
]Notice what matters for an API: sku stays text with its leading zero, price is a number, and in_stock is a real true/false, not the text "true". Getting those types right is most of the work.
Step 1: Clean the CSV before converting
Five minutes in the spreadsheet saves an hour of debugging:
- One header row, no merged cells, no title rows above it. The first row must be the field names.
- Use API-friendly header names.
product_nameorproductName, notProduct Name (BDT). Matching the API’s field names now saves a rename later. - Remove totals, notes and blank rows at the bottom of the sheet.
- Save as CSV UTF-8. In Excel: File → Save As → CSV UTF-8 (Comma delimited). Plain “CSV” can mangle Bangla, Arabic, accented or emoji characters.
- Keep codes as text. If Excel already turned
0451into451, fix the column (Format → Text and re-type, or re-import) before exporting.
Step 2: Convert
- Open doetra.com/json-to-csv/csv-to-json.
- Paste the CSV or drop the file. Doetra also reads TSV (tab-separated) exports.
- Pick JSON as the output and review it as code.
- Copy, download, or share it as a link.
Doetra runs in your browser, so customer lists and price sheets are never uploaded to a server, and there’s no row limit beyond the 25 MB file size.
Step 3: Check the types
APIs are strict about types. Before sending anything, scan the JSON for these:
| Field | What the API usually wants | Common mistake |
|---|---|---|
| Prices, quantities | Number: 12.5 | Text: "12.50", or "1,250" with a thousands comma |
| Yes/no flags | Boolean: true | "TRUE", "Yes", 1 |
| SKUs, phone numbers, zip codes | Text: "0451" | Number 451, leading zero gone |
| Dates | ISO text: "2026-11-15" | "15/11/26" or an Excel serial number like 46341 |
| Empty cells | null or the field left out | Empty string "" where a number is expected |
If a column has the wrong format, fix it in the sheet (for example, change Yes/No to true/false, or dates to YYYY-MM-DD) and convert again. That’s quicker than editing JSON by hand.
Step 4: Match the API’s shape
A CSV gives you a flat list of objects. Many APIs want something different:
- A wrapper object. Some endpoints expect
{ "products": [ ... ] }instead of a bare list. Paste the converted list inside the wrapper. - Nested fields. An API might want
{ "price": { "amount": 12.5, "currency": "BDT" } }. Plan for this in the header with dotted names likeprice.amountandprice.currency, which map naturally to nested objects; check the output before relying on it. - One request per record. Many APIs accept one object per call, or batches of 50 to 100. Split large lists to stay under rate limits.
- Exact field names.
productNameandproduct_nameare different keys. Copy names straight from the API docs.
Step 5: Validate before sending
Send one record first and read the error message carefully. It usually names the field. Better still, if the API publishes a JSON Schema, check your data against it before sending anything. Developers can also generate TypeScript types from the JSON to catch mismatches in code.
Common errors and what they mean
- 400 Bad Request / “invalid type”. A number was sent as text, or the other way round. Re-check Step 3.
- “Unexpected token” or “invalid JSON”. The JSON was edited by hand and has a stray comma or quote. Paste it back into Doetra, which shows the line.
- Garbled characters in the result. The CSV wasn’t saved as UTF-8. Export again with CSV UTF-8.
- Every value is in one field. The file uses semicolons or tabs, not commas (common in European Excel). Export as comma-separated, or save as tab-separated and convert that.
- Missing records. Blank rows or a stray header in the middle of the sheet. Clean the sheet and convert again.
Going the other way
Got JSON from an API and want it back in a spreadsheet? See how to convert JSON to CSV and how to open JSON in Excel.
Frequently asked questions
How do I convert CSV to JSON for free?
Paste the CSV into Doetra and choose JSON as the output. It’s free, with no sign-up, and the file isn’t uploaded.
Can I convert an Excel file (.xlsx) to JSON?
Save the sheet as CSV UTF-8 first (File → Save As), then convert the CSV. Each sheet needs its own CSV.
Why are my numbers in quotes?
The column probably contains text: thousands separators, currency symbols, or spaces. Remove them in the sheet so the column holds plain numbers, then convert again.
Is there a size limit?
Files up to 25 MB, with no daily cap.
Ready? Convert your CSV to JSON →