JSON (JavaScript Object Notation) has become the standard format for data exchange between applications. APIs, databases, and configuration files all use JSON. But when it comes to analyzing or sharing that data with business stakeholders, Excel remains the go-to tool. The challenge is bridging the gap between these two formats.
In this guide, we will walk through three practical methods to convert JSON data into Excel spreadsheets, starting with the simplest approach and moving to more advanced options.
Method 1: Using an Online JSON to Excel Converter
The fastest way to convert JSON to Excel is using a browser-based converter tool. This approach requires no software installation and works on any device with a web browser.
Step-by-Step Process
- Open the converter tool โ Navigate to jsontoexcel.net in your browser.
- Input your JSON data โ You can either paste JSON text directly into the editor or upload a
.jsonfile using the file upload feature. - Click "Convert to Excel" โ The tool parses your JSON and generates a tabular preview.
- Review the preview โ Check that all columns and rows appear as expected. Nested objects will be flattened using dot notation (e.g.,
user.address.city). - Download โ Click "Download Excel File" to save the
.xlsxfile to your computer.
When to Use This Method
- Quick, one-off conversions
- Sharing API responses with non-technical colleagues
- Small to medium datasets (under 10MB)
- When you do not want to install any software
Method 2: Using Excel's Built-in Power Query
Microsoft Excel (2016 and later) includes Power Query, a powerful data import tool that can read JSON files directly. This method is best when you need repeatable imports or want to apply transformations within Excel itself.
Step-by-Step Process
- Open Excel and create a new workbook.
- Go to Data โ Get Data โ From File โ From JSON.
- Select your JSON file from the file browser.
- Power Query Editor opens โ You will see a preview of your data. If your JSON contains an array of objects, Power Query will display each record as a row.
- Expand columns โ Click the expand icon (two arrows) next to any column that contains nested records or lists.
- Transform data โ Use Power Query tools to rename columns, filter rows, change data types, or remove unwanted fields.
- Click "Close & Load" โ The transformed data loads into your Excel worksheet as a table.
Advantages of Power Query
- Repeatable โ Save your query and refresh it whenever the source file updates.
- Built-in โ No external tools or internet connection required.
- Transformations โ Apply filters, data type changes, and column renaming before loading data.
Method 3: Using Python with pandas and openpyxl
For developers and data professionals who need to automate conversions or handle very large files, Python provides the most flexible approach.
Prerequisites
Install the required libraries:
pip install pandas openpyxlBasic Conversion Script
import pandas as pd
import json
# Load JSON data
with open('data.json', 'r') as f:
data = json.load(f)
# Convert to DataFrame
df = pd.json_normalize(data)
# Export to Excel
df.to_excel('output.xlsx', index=False, engine='openpyxl')
print(f"Converted {len(df)} rows to output.xlsx")Handling Nested JSON
The pd.json_normalize() function is particularly powerful for nested structures. It automatically flattens nested objects and creates column names using dot notation, similar to what online converters do.
# For deeply nested JSON
df = pd.json_normalize(
data,
sep='.', # Separator for nested keys
max_level=3 # Maximum depth to flatten
)When to Use Python
- Automated pipelines that run on a schedule
- Very large files (hundreds of MB or more)
- Custom transformation logic needed
- Batch processing multiple JSON files
Comparing the Three Methods
| Feature | Online Converter | Power Query | Python Script |
|---|---|---|---|
| Setup Required | None | Excel 2016+ | Python + libraries |
| Ease of Use | Very easy | Moderate | Requires coding |
| Nested JSON | Automatic flattening | Manual expand steps | json_normalize() |
| File Size Limit | ~10MB (browser) | Limited by RAM | Limited by RAM |
| Automation | No | Refresh queries | Full automation |
| Privacy | Client-side processing | Local only | Local only |
Best Practices for Any Method
- Validate your JSON first โ Run your data through a JSON validator to catch syntax errors before converting. Missing commas or mismatched brackets will cause all methods to fail.
- Keep structures consistent โ Ensure all objects in an array have the same set of keys. Inconsistent structures create sparse columns with many empty cells.
- Handle arrays intentionally โ Decide whether arrays should be joined as comma-separated values in a single cell or expanded into separate columns.
- Check data types โ Numbers stored as strings in JSON may need type conversion in Excel. Dates especially need attention.
- Test with a sample โ Before converting a large file, test with a small subset to verify the output format meets your needs.
Common Issues and Solutions
Issue: Empty cells in the output
This usually happens when JSON objects have inconsistent keys. Some records have a field while others do not. The converter creates a column for every unique key it encounters, leaving cells empty where a record is missing that field.
Issue: Arrays appearing as a single cell
Simple arrays (like ["tag1", "tag2"]) are typically joined with a separator character. If you need each array element in its own column, you may need to restructure your JSON or use a post-processing step in Excel.
Issue: Truncated data
Excel cells have a 32,767 character limit. If a JSON value is extremely long (like a base64-encoded image), it may be truncated in the output. Consider removing such fields before conversion.
Ready to Convert Your JSON?
Try our free converter โ no registration required, all processing happens in your browser.
Convert JSON to Excel Now โ