0

How to extract json

{"scoreboard":{"lastUpdatedOn":"2017-08-21 6:58:49 PM","gameScore":[{"game":{"ID":"40380","week":"1","scheduleStatus":"Normal","originalDate":null,"originalTime":null,"delayedOrPostponedReason":null,"date":"2017-09-11","time":"7:10PM","awayTeam":{"ID":"70","City":"New Orleans","Name":"Saints","Abbreviation":"NO"},"homeTeam":{"ID":"63","City":"Minnesota","Name":"Vikings","Abbreviation":"MIN"},"location":"TCF Bank Stadium"},"isUnplayed":"true","isInProgress":"false","isCompleted":"false","quarterSummary":null}

How to extract above json by php

$allnfls = $nfls['scoreboard']['gameScore'];

        foreach($allnfls as $allnfl)
        {
            //foreach($allnfld as $allnfl) {

                $gameid = $allnfl['ID'];
                echo "<br>".$week = $allnfl['game']['week'];
}
Amit Kanala
  • 123
  • 1
  • 1
  • 12

1 Answers1

0

Define a variable and use json_decode(YourJSONString,true)

rebru
  • 519
  • 3
  • 10