Answer the question
In order to leave comments, you need to log in
How to get all users from Json?
So there is Json:
"members": [
{
"user": {
"id": 1,
"username": "blabla1",
"level": 22,
"rank": "PLAYER",
"status": "MEMBER",
"guildCoins": 0,
"guildExp": 125
},
{
"user": {
"id": 2,
"username": "blabla2",
"level": 19,
"rank": "PLAYER",
"status": "MEMBER",
"guildCoins": 0,
"guildExp": 358
},
{
"user": {
"id": 3,
"username": "blablabla3",
"level": 31,
"rank": "PLAYER",
"playedSeconds": 2249862
"status": "MEMBER",
"guildCoins": 0,
"guildExp": 1130
},
{
"user": {
"id": 4
"username": "val12blabla,
"level": 20,
"rank": "PLAYER",
"playedSeconds": 1398004
"status": "OFFICER",
"guildCoins": 22817,
"guildExp": 4704
}]
echo $obj_guild->members->user->{'username'};
$obj_guild
Answer the question
In order to leave comments, you need to log in
$obj = json_decode($data);
foreach ($obj->members as $member) {
echo $member->user->username.PHP_EOL;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question