// Code examples from: JSON Explained Simply (for Excel People)
// https://www.atulvij.com/json-explained-simply
// Review and adapt before running; examples use sample values.

// ---- Example 1 (json) ----
{
  "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 }
  ]
}

// ---- Example 2 (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)

