I'm having problem with creating a foreach loop out of a JSON, I can't get the values out of the array correct, what am I doing wrong?
JSON:
[
{"Pages":{
"name":"Name 1",
"id":"3342939832994"
}
},
{"Pages":{
"name":"Name 2",
"id":"289051164453763"
}
}
]
PHP:
$json = $_POST['Publish'];
$json = $json->Pages
foreach($json as $key => $items) {
$id = $items->id;
$name = $items->id;
}
json_decodethe data. What's the next question?