How to Convert JSON to CSV for Excel
Published: May 23, 2025 · 5 min read
You have JSON data from an API and need to open it in Excel or Google Sheets. JSON's nested structure doesn't directly translate to rows and columns — so you need a conversion step. This guide shows you exactly how to do it.
What You Need
For JSON to CSV conversion to work, your JSON should be an array of objects where each object represents a row:
This converts cleanly to a table with 3 rows and 3 columns (name, age, city).
Method 1: Online Tool (Fastest)
The quickest approach for any size of data:
- Go to JSON ↔ CSV Converter
- Paste your JSON array in the input editor
- Click "Convert to CSV"
- Preview the table to verify correctness
- Click "Download CSV" — open directly in Excel
The tool handles edge cases automatically: commas in values get properly quoted, nested objects get flattened, and null values become empty cells.
Method 2: JavaScript Code
If you need to convert programmatically:
Method 3: Python
Handling Nested Objects
Real-world JSON often has nested structures:
You can't put an object into a single CSV cell. The solution is flattening — converting nested keys to dot notation:
Our JSON to CSV tool does this flattening automatically. Each nested key becomes a separate column with a dotted path name.
Handling Arrays Inside Objects
If a field contains an array (e.g., "tags": ["dev", "admin"]), it gets serialized as a JSON string in the CSV cell: "[""dev"",""admin""]". This preserves the data but isn't ideal for spreadsheet analysis. Consider extracting arrays into separate columns or rows depending on your needs.
Tips for Clean Conversion
- Ensure all objects in your array have the same keys — inconsistent keys may cause empty columns
- Remove null or undefined values before converting if you want clean spreadsheets
- For large datasets (10,000+ rows), convert in chunks to avoid browser memory issues
- If you need Excel format (.xlsx) directly, use our JSON to Excel converter instead
- For bulk conversion of multiple files, try Bulk Convert
CSV to JSON (Reverse)
Need to go the other direction? Our tool also converts CSV back to JSON. The first row becomes the property names, and each subsequent row becomes a JSON object. This is useful when importing spreadsheet data into a web application or API.