How to Convert JSON to CSV
JSON is how APIs send structured data. CSV is what spreadsheets read. Converting between them is a routine task that becomes awkward the moment your data has nested objects, so it is worth understanding how the conversion actually works.
What the Two Formats Look Like
JSON nests data using braces and is the default format for web APIs. CSV is a flat grid: one header row naming the columns, then one row per record.
- JSON:
{"name":"Ada","age":36} - CSV:
name,ageon the first line, thenAda,36
A JSON array becomes multiple CSV rows. A single JSON object becomes a single row.
The Nested Object Problem
A CSV row is flat by definition, so a nested object has no direct equivalent. Most converters flatten it using a dot or underscore, turning {"user":{"name":"Ada"}} into a column called user.name.
Arrays are usually handled one of two ways. Either each array element becomes its own row, which suits a list of items, or the array is joined into one cell with a delimiter, which suits a list of tags. You need to know which convention your spreadsheet expects before importing.
Step by Step
Step 1 — Check the JSON is valid. A trailing comma or a single-quoted key will break the conversion. Validate it first with our JSON Formatter, which reports the exact line of any error.
Step 2 — Decide how to handle nesting. Flatten with dots, or unnest manually first if you only need a few fields.
Step 3 — Choose a delimiter. If your values contain commas, use a semicolon or tab instead, or let the converter quote and escape values automatically.
Step 4 — Convert and open. Open the result in Excel or Google Sheets. If everything lands in one column, your delimiter is wrong.
Common Mistakes
- Whole file in one column — usually a wrong delimiter, or the file was not actually converted.
- Missing values — records with different key sets produce blank cells. Standardise the keys before converting.
- Numbers turned into text — spreadsheet software imports large numbers or values like leading-zero IDs as text. Force the column type after opening.
- Dates in the wrong format — JSON usually uses ISO 8601, which spreadsheets may read as text.
Frequently Asked Questions
Related Tools
Shop for calculators and productivity tools on Amazon — great deals for every need.
Shop on Amazon →