Доброго времени суток, помогите вытащить нужную информацию из JSON.
Сам JSON:
"profiles": [
{
"id": 404149344,
"first_name": "German",
"last_name": "Rudenko",
"sex": 2,
"screen_name": "yip.su2z9qe5",
"photo_50": "https://sun1-84.userapi.com/c855520/v855520688/1bb4a9/UKDJdSZUJEo.jpg?ava=1",
"photo_100": "https://sun1-95.userapi.com/c855520/v855520688/1bb4a8/K1iTkyCWqOQ.jpg?ava=1",
"online": 0,
"online_info": {
"visible": true,
"last_seen": 1578736585
}
},
{
"id": 420026899,
"first_name": "Максим",
"last_name": "Плотников",
"sex": 2,
"screen_name": "iotkroutebejisn",
"photo_50": "https://sun9-50.userapi.com/c857328/v857328056/9d3b0/iqOo7GGnTrI.jpg?ava=1",
"photo_100": "https://sun9-39.userapi.com/c857328/v857328056/9d3af/oHXDFQ1Kcig.jpg?ava=1",
"online": 1,
"online_info": {
"visible": true,
"is_online": true
}
},
{
"id": 547543178,
"first_name": "Собака",
"last_name": "Удачи",
"sex": 2,
"screen_name": "pomolllnikfgb",
"photo_50": "https://sun1-85.userapi.com/c200820/v200820398/1c3cd/hOWzjK0InQ4.jpg?ava=1",
"photo_100": "https://sun1-99.userapi.com/c200820/v200820398/1c3cc/wsXyBLwDHOc.jpg?ava=1",
"online": 0,
"online_info": {
"visible": false,
"status": "recently"
}
}
],
"groups": [
{
"id": 190687635,
"name": "Подсчет постов и статистики",
"screen_name": "club190687635",
"is_closed": 1,
"type": "group",
"photo_50": "https://vk.com/images/community_50.png?ava=1",
"photo_100": "https://vk.com/images/community_100.png?ava=1",
"photo_200": "https://vk.com/images/community_200.png?ava=1"
}
]
Нужно брать информацию из profiles -> id
Вот мой код, но он не работает. В чем ошибка?
$json_users = json_encode($request);
foreach ($json_users as $key) {
$users_list = $key['id']."\n";
}