There are so many JSON/PHP/Decode related post out there... but I am struggling here. I'm pretty sure I have built my JSON incorrectly, but I can't seem to see my mistake. Can anyone help?
{
"badging": [
{
"event": [
{
"eventName": "Covent Garden",
"numberOfRooms": "1",
"mainLang": "xx",
"timeZone": "saas"
}
]
},
{
"names": [
{
"id": "1",
"fName": "Daniel",
"pos": "King"
},
{
"id": "2",
"fName": "Dasha",
"pos": "Queen"
}
]
}
]
}
This is posted to a PHP page and json_decode is used
$json = $_POST['feed'];
$list = json_decode($json, TRUE);
And I feel I should be able to access the data like:
echo $list[1][2]['fName'];
or
echo $list->badging[1]->names[2]->fName;
but I can't seem to do it. thanks