1$json = '
2{
3 "type": "donut",
4 "name": "Cake",
5 "toppings": [
6 { "id": "5002", "type": "Glazed" },
7 { "id": "5006", "type": "Chocolate with Sprinkles" },
8 { "id": "5004", "type": "Maple" }
9 ]
10}';
11
12$yummy = json_decode($json, true);
13
14echo $yummy['toppings'][2]['type']; //Maple
15