Best way to deserialize Json array in php? -


this question has answer here:

what's way deserialize json in php? actual thought not use external libraries through code. downloaded resource:

$variable = file_get_contents("http://api.football-data.org/alpha/soccerseasons/"); $decoded = json_decode($variable); var_dump($decoded); 

now have in variable array decoded, advise me values of json?

update - decoded content:

array(11) { [0]=> object(stdclass)#1 (7) { ["_links"]=> object(stdclass)#2 (4) { ["self"]=> object(stdclass)#3 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/394" } ["teams"]=> object(stdclass)#4 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/394/teams" } ["fixtures"]=> object(stdclass)#5 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/394/fixtures" } ["leaguetable"]=> object(stdclass)#6 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/394/leaguetable" } } ["caption"]=> string(21) "1. bundesliga 2015/16" ["league"]=> string(3) "bl1" ["year"]=> string(4) "2015" ["numberofteams"]=> int(18) ["numberofgames"]=> int(306) ["lastupdated"]=> string(20) "2015-07-15t05:21:07z" } [1]=> object(stdclass)#7 (7) { ["_links"]=> object(stdclass)#8 (4) { ["self"]=> object(stdclass)#9 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/395" } ["teams"]=> object(stdclass)#10 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/395/teams" } ["fixtures"]=> object(stdclass)#11 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/395/fixtures" } ["leaguetable"]=> object(stdclass)#12 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/395/leaguetable" } } ["caption"]=> string(21) "2. bundesliga 2015/16" ["league"]=> string(3) "bl2" ["year"]=> string(4) "2015" ["numberofteams"]=> int(18) ["numberofgames"]=> int(306) ["lastupdated"]=> string(20) "2015-08-03t02:28:27z" } [2]=> object(stdclass)#13 (7) { ["_links"]=> object(stdclass)#14 (4) { ["self"]=> object(stdclass)#15 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/396" } ["teams"]=> object(stdclass)#16 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/396/teams" } ["fixtures"]=> object(stdclass)#17 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/396/fixtures" } ["leaguetable"]=> object(stdclass)#18 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/396/leaguetable" } } ["caption"]=> string(15) "ligue 1 2015/16" ["league"]=> string(3) "fl1" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-07-31t06:12:34z" } [3]=> object(stdclass)#19 (7) { ["_links"]=> object(stdclass)#20 (4) { ["self"]=> object(stdclass)#21 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/397" } ["teams"]=> object(stdclass)#22 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/397/teams" } ["fixtures"]=> object(stdclass)#23 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/397/fixtures" } ["leaguetable"]=> object(stdclass)#24 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/397/leaguetable" } } ["caption"]=> string(15) "ligue 2 2015/16" ["league"]=> string(3) "fl2" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-08-02t12:20:09z" } [4]=> object(stdclass)#25 (7) { ["_links"]=> object(stdclass)#26 (4) { ["self"]=> object(stdclass)#27 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/398" } ["teams"]=> object(stdclass)#28 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/398/teams" } ["fixtures"]=> object(stdclass)#29 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/398/fixtures" } ["leaguetable"]=> object(stdclass)#30 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/398/leaguetable" } } ["caption"]=> string(22) "premier league 2015/16" ["league"]=> string(2) "pl" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-07-31t06:02:18z" } [5]=> object(stdclass)#31 (7) { ["_links"]=> object(stdclass)#32 (4) { ["self"]=> object(stdclass)#33 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/399" } ["teams"]=> object(stdclass)#34 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/399/teams" } ["fixtures"]=> object(stdclass)#35 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/399/fixtures" } ["leaguetable"]=> object(stdclass)#36 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/399/leaguetable" } } ["caption"]=> string(24) "primera division 2015/16" ["league"]=> string(2) "pd" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-07-15t05:27:20z" } [6]=> object(stdclass)#37 (7) { ["_links"]=> object(stdclass)#38 (4) { ["self"]=> object(stdclass)#39 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/400" } ["teams"]=> object(stdclass)#40 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/400/teams" } ["fixtures"]=> object(stdclass)#41 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/400/fixtures" } ["leaguetable"]=> object(stdclass)#42 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/400/leaguetable" } } ["caption"]=> string(24) "segunda division 2015/16" ["league"]=> string(2) "sd" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(420) ["lastupdated"]=> string(20) "2015-07-19t09:47:33z" } [7]=> object(stdclass)#43 (7) { ["_links"]=> object(stdclass)#44 (4) { ["self"]=> object(stdclass)#45 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/401" } ["teams"]=> object(stdclass)#46 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/401/teams" } ["fixtures"]=> object(stdclass)#47 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/401/fixtures" } ["leaguetable"]=> object(stdclass)#48 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/401/leaguetable" } } ["caption"]=> string(15) "serie 2015/16" ["league"]=> string(2) "sa" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-07-31t06:00:43z" } [8]=> object(stdclass)#49 (7) { ["_links"]=> object(stdclass)#50 (4) { ["self"]=> object(stdclass)#51 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/402" } ["teams"]=> object(stdclass)#52 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/402/teams" } ["fixtures"]=> object(stdclass)#53 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/402/fixtures" } ["leaguetable"]=> object(stdclass)#54 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/402/leaguetable" } } ["caption"]=> string(21) "primeira liga 2015/16" ["league"]=> string(3) "ppl" ["year"]=> string(4) "2015" ["numberofteams"]=> int(18) ["numberofgames"]=> int(306) ["lastupdated"]=> string(20) "2015-07-31t06:15:10z" } [9]=> object(stdclass)#55 (7) { ["_links"]=> object(stdclass)#56 (4) { ["self"]=> object(stdclass)#57 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/403" } ["teams"]=> object(stdclass)#58 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/403/teams" } ["fixtures"]=> object(stdclass)#59 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/403/fixtures" } ["leaguetable"]=> object(stdclass)#60 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/403/leaguetable" } } ["caption"]=> string(21) "3. bundesliga 2015/16" ["league"]=> string(3) "bl3" ["year"]=> string(4) "2015" ["numberofteams"]=> int(20) ["numberofgames"]=> int(380) ["lastupdated"]=> string(20) "2015-08-03t02:28:50z" } [10]=> object(stdclass)#61 (7) { ["_links"]=> object(stdclass)#62 (4) { ["self"]=> object(stdclass)#63 (1) { ["href"]=> string(52) "http://api.football-data.org/alpha/soccerseasons/404" } ["teams"]=> object(stdclass)#64 (1) { ["href"]=> string(58) "http://api.football-data.org/alpha/soccerseasons/404/teams" } ["fixtures"]=> object(stdclass)#65 (1) { ["href"]=> string(61) "http://api.football-data.org/alpha/soccerseasons/404/fixtures" } ["leaguetable"]=> object(stdclass)#66 (1) { ["href"]=> string(64) "http://api.football-data.org/alpha/soccerseasons/404/leaguetable" } } ["caption"]=> string(18) "eredivisie 2015/16" ["league"]=> string(3) "ded" ["year"]=> string(4) "2015" ["numberofteams"]=> int(18) ["numberofgames"]=> int(306) ["lastupdated"]=> string(20) "2015-08-03t02:34:21z" } } 

try

$decoded = json_decode($variable,true); 

it should create array. easier use


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -