P
P
Pobepto2015-11-01 22:08:56
PHP
Pobepto, 2015-11-01 22:08:56

How to decode long JSON request via PHP?

Good afternoon, there is a long JSON request from which you need to display information, but I don’t know how to get, for example, to such a line - "totalChampionKills" (399), where "playerStatSummaryType" = "AramUnranked5x5" 70add06be2f7472c8ee2a1d770092a7b.PNG
I know what to do like this:

$jsondata = file_get_contents($url);	
$data = json_decode($jsondata, true); 
$totalChampionKills = $data[...]*

And then, from this moment "$data[...]*" I don't know what to do, I don't know how to get to such a depth.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav, 2015-11-01
@Pobepto

foreach ($data['playerStatSummaries'] as $row)
{
  if($row['playerStatSummaryType'] == "AramUnranked5x5")
  {
    echo $row['aggregatedStats']['totalChempionKills'];
  } else {
    continue;
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question