I have been trying to parse a JSON response since few days without success. I've read on the internet and this site how to parse with a foreach but I think the structure of json is too different from the examples I've found. So here is the JSON:
array(1)
{ ["matches"]=> array(10)
{ [0]=> array(13) { ["matchId"]=> int(2125878813)
["region"]=> string(3) "EUW"
["platformId"]=> string(4) "EUW1"
["matchMode"]=> string(7) "CLASSIC"
["matchType"]=> string(12) "MATCHED_GAME"
["matchCreation"]=> float(1432656547642)
["matchDuration"]=> int(1852)
["queueType"]=> string(15) "RANKED_SOLO_5x5"
["mapId"]=> int(11)
["season"]=> string(10) "SEASON2015"
["matchVersion"]=> string(9) "5.9.0.318"
["participants"]=> array(1)
{ [0]=> array(10) {
["teamId"]=> int(200)
["spell1Id"]=> int(7)
["spell2Id"]=> int(4)
["championId"]=> int(67)
["highestAchievedSeasonTier"]=> string(8) "PLATINUM"
["timeline"]=> array(9)
{ ["creepsPerMinDeltas"]=> array(3)
{ ["zeroToTen"]=> float(6.2)
["tenToTwenty"]=> float(7.4)
["twentyToThirty"]=> float(4.4) }
["xpPerMinDeltas"]=> array(3)
{ ["zeroToTen"]=> float(336.2)
["tenToTwenty"]=> float(428.3)
["twentyToThirty"]=> float(396) }
["goldPerMinDeltas"]=> array(3) {
["zeroToTen"]=> float(270.7)
["tenToTwenty"]=> float(363.6)
["twentyToThirty"]=> float(294.8) }
If I understand well this is an array with tabs inside and arrays also ?
I would like for example to display the 10 matches id : matches->matchId matches->participants->championId matches->participants->timeline->creepsPerMinDeltas->zeroToTen
Here is what I've done so far to display the matchId
:
$decodeHisto = json_decode ($resultHisto,true);
//var_dump($decodeHisto);
foreach ($decodeHisto{[matches]} as $d)
{
echo $d->{[matchId]}-;
}
Can anyone help me please ?