
📎 This article includes 1 downloadable practice file ↓
Almost every web service and API sends data as JSON. It looks scary but follows only a few rules.
{
"invoice": "INV-1042",
"date": "2019-05-14",
"paid": true,
"customer": { "name": "Asha Traders", "city": "Pune" },
"lines": [
{ "item": "Keyboard", "qty": 2, "price": 1299 },
{ "item": "Mouse", "qty": 5, "price": 599 }
]
}
{ }an object: named fields (like one row with column names).[ ]an array: a list (like several rows).- Values are text in quotes, numbers,
true/false,null, or more objects/arrays.
From JSON to a table
The lines array becomes two rows; the invoice fields repeat on each. That “flattening” is exactly what Power Query does.
Load JSON in Excel
Data → Get Data → From File → From JSON (or From Web for an API URL). In Power Query, click To Table, then the expand buttons (↔) on record and list columns until you have plain columns.
…or with Python
import json, pandas as pd
data = json.load(open("invoice.json"))
df = pd.json_normalize(data, record_path="lines", meta=["invoice", "date", ["customer", "name"]])
df.to_excel("invoice.xlsx", index=False)
📎 Practice files for this article
- 📄All code from this post2 examples in one file, ready to open in your editor.⬇ JSON · 691 B
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Atul (AJ) builds office-automation and local-first AI tools as Atulya AI, and works with Excel, SAP and Oracle EPM every day. He writes about the shortcuts, macros and automations that actually save time — plus the occasional wacky fact. Videos on YouTube: Lazy Automator AI (@LazyAutomatorAI).
More posts by Atul →Stuck on a step? Ask a question and the AI answers using this article.