ANSWER: PHP/JSON - stdClass Object
I tried to read some statistics from a json like this, but I make a mistake somewhere.
I tried with foreach function, but i don't know where is the mistake:
foreach($myDecodedStringFromJSon->playerStatsSummaries as $stats){
// Do some here
}
This is my JSON:
{
"summonerId":39656713,
"playerStatSummaries":[
{
"playerStatSummaryType":"CAP5x5",
"wins":0,
"modifyDate":1431942577000,
"aggregatedStats":{
"totalChampionKills":3,
"totalMinionKills":79,
"totalTurretsKilled":0,
"totalNeutralMinionsKilled":0,
"totalAssists":4
}
},
{
"playerStatSummaryType":"CoopVsAI",
"wins":22,
"modifyDate":1431942577000,
"aggregatedStats":{
"totalChampionKills":73,
"totalMinionKills":2344,
"totalTurretsKilled":24,
"totalNeutralMinionsKilled":0,
"totalAssists":179
}
},
{
"playerStatSummaryType":"OdinUnranked",
"wins":0,
"modifyDate":1431942577000,
"aggregatedStats":{
}
},
{
"playerStatSummaryType":"Unranked",
"wins":18,
"modifyDate":1431942577000,
"aggregatedStats":{
"totalChampionKills":63,
"totalMinionKills":1789,
"totalTurretsKilled":14,
"totalNeutralMinionsKilled":5,
"totalAssists":181
}
},
{
"playerStatSummaryType":"Unranked3x3",
"wins":0,
"modifyDate":1431942577000,
"aggregatedStats":{
}
},
{
"playerStatSummaryType":"AramUnranked5x5",
"wins":38,
"modifyDate":1445430660000,
"aggregatedStats":{
"totalChampionKills":414,
"totalTurretsKilled":28,
"totalAssists":1556
}
}
]
}
EDIT:
stdClass Object ( [summonerId] => 39656713 [playerStatSummaries] => Array ( [0] => stdClass Object ( [playerStatSummaryType] => CAP5x5 [wins] => 0 [modifyDate] => 1431942577000 [aggregatedStats] => stdClass Object ( [totalChampionKills] => 3 [totalMinionKills] => 79 [totalTurretsKilled] => 0 [totalNeutralMinionsKilled] => 0 [totalAssists] => 4 ) ) [1] => stdClass Object ( [playerStatSummaryType] => CoopVsAI [wins] => 22 [modifyDate] => 1431942577000 [aggregatedStats] => stdClass Object ( [totalChampionKills] => 73 [totalMinionKills] => 2344 [totalTurretsKilled] => 24 [totalNeutralMinionsKilled] => 0 [totalAssists] => 179 ) ) [2] => stdClass Object ( [playerStatSummaryType] => OdinUnranked [wins] => 0 [modifyDate] => 1431942577000 [aggregatedStats] => stdClass Object ( ) ) [3] => stdClass Object ( [playerStatSummaryType] => Unranked [wins] => 18 [modifyDate] => 1431942577000 [aggregatedStats] => stdClass Object ( [totalChampionKills] => 63 [totalMinionKills] => 1789 [totalTurretsKilled] => 14 [totalNeutralMinionsKilled] => 5 [totalAssists] => 181 ) ) [4] => stdClass Object ( [playerStatSummaryType] => Unranked3x3 [wins] => 0 [modifyDate] => 1431942577000 [aggregatedStats] => stdClass Object ( ) ) [5] => stdClass Object ( [playerStatSummaryType] => AramUnranked5x5 [wins] => 38 [modifyDate] => 1445430660000 [aggregatedStats] => stdClass Object ( [totalChampionKills] => 414 [totalTurretsKilled] => 28 [totalAssists] => 1556 ) ) ) )
print_r($myDecodedStringFromJSon)for us. But as far as i can guess you string was decoded as array$myDecodedStringFromJSon['playerStatsSummaries']