Guide
Converting CSV to JSON (and back) for APIs, code and imports
CSV is how spreadsheets, databases and export buttons hand out data; JSON is what code, APIs and NoSQL databases expect. Converting between them is a common first step when importing data, seeding a test database, or sending a spreadsheet to an API. This converter works in both directions, previews the table, and keeps your data in the browser.
CSV to JSON
- Choose CSV → JSON.
- Paste CSV, or open a .csv, .tsv or .txt file. Comma, semicolon and tab separators are detected automatically.
- Check the table preview (the first 50 rows).
- Set the options:
- First row is the header: each row becomes an object, such as
{"name": "Ana", "city": "Lisbon"}. Off: each row is an array,["Ana", "Lisbon"]. - Detect numbers and true/false:
42becomes a number andtruea boolean instead of strings.
- First row is the header: each row becomes an object, such as
- Copy the JSON or download data.json.
If a row has problems, such as an unclosed quote or a different number of fields, the converter reports it with the row number.
Objects or arrays?
| Shape | Looks like | Use when |
|---|---|---|
| Array of objects (header on) | [{"id": 1, "name": "Ana"}] |
APIs, JavaScript, MongoDB imports, most code |
| Array of arrays (header off) | [[1, "Ana"]] |
Compact data, charts, files without a header row |
Type detection: when to turn it off
Detection is convenient: amounts and counts become real numbers you can calculate with. But it changes values that only look numeric:
- Leading zeros:
00123becomes123, losing the zeros of ZIP codes, phone numbers and product codes. - Long IDs: very long digit strings can lose precision as numbers.
- Version numbers:
1.10becomes1.1.
If any column holds codes rather than quantities, turn detection off and convert numbers in your code.
Typical CSV problems
- Commas inside values must be quoted:
"Lisbon, Portugal". Spreadsheet exports already do this. - Semicolon CSVs come from Excel in many European locales; detection handles them.
- Title lines above the header, common in bank exports, break the column structure. Delete them first.
- Accented characters showing as é mean the file isn’t UTF-8. Open it in a spreadsheet app and save it as “CSV UTF-8”.
JSON to CSV
Choose JSON → CSV and paste an array of objects (a single object also works). The keys become the header row, and each object becomes a line. Download data.csv and open it in Excel, Google Sheets or the CSV to Excel converter for a formatted workbook.
Nested JSON doesn’t fit into columns, because CSV is flat. Flatten nested objects first, such as turning address.city into a key of its own, or check the structure in the JSON Formatter.
Starting from Excel?
Export the sheet as CSV with Excel to CSV, choosing the right sheet, then convert here.
Privacy
Customer lists and exports often contain personal data. The conversion runs entirely in your browser and nothing is uploaded.
Who converts CSV and JSON
- Developers turn spreadsheet data into JSON for APIs, apps and test fixtures.
- Data analysts export JSON from APIs as CSV for spreadsheets.
- Content managers prepare product or location lists for websites.
- Students practice working with structured data.
A complete example: a store locator file
- Keep a spreadsheet with columns name, city, lat, lng.
- Export it as CSV and paste it here.
- Keep First row is the header on, and number detection on so coordinates become numbers.
- Copy the JSON array and save it as stores.json for the website’s map.
Tips
- Turn number detection off for codes with leading zeros.
- Flatten nested JSON before converting it to CSV.
Related tools
- JSON Formatter to validate and explore the JSON.
- Excel to CSV and CSV to Excel for spreadsheets.
- YAML to JSON for configuration data.
Checked against the current version of the CSV ⇄ JSON on .

