java - Read JSCON file with PHP -


i'm trying read json php array. json file using format not familiar , don't know how write php array read file.

json file in question can found here: http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/ana/iphone/clubroster.json

the format giving me hard time because 1) starting time stamp array cannot read , 2) file separated between value position, means have closing statement ' }] ' before end of file - seems separated category

my php array work more standard array :

function myfunction(response) {     var arr = json.parse(response);     var i;     var out = "<table>";      for(i = 0; < arr.length; i++) {         out += "<tr><td>" +          arr[i].position +         "</td><td>" +         arr[i].weight +         "</td><td>" +         arr[i].height +         "</td></tr>";     } out += "</table>" document.getelementbyid("id01").innerhtml = out; 

}

thank you

it called json, not jscon. code posted javascript, not php.

here example of how read json provided php:

<?php     $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/ana/iphone/clubroster.json");     $json = json_decode($result);     foreach ($json->goalie $player) {         echo $player->name . '</br>';     } ?> 

this print each goalie's name.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -