简体   繁体   中英

json array not displaying the values

I have the following json array, I am trying to retrive the values but it does not work

 => Array (
    [url] => http://chrome.blogspot.com/feeds/posts/default
    [title] => <b>Google</b> Chrome <b>Blog</b>

This is the code I am using in php to retrive the values

$json = json_decode($res, true);

echo $json['url'];

Can some one help on this.

Its any array of arrays

echo $json[0]['url'];

From the comment

Array ( [responseData] =>
            Array ( [query] => Official Google Blogs 
                              [entries] => Array ( [0]=>


 echo $json['responseData']['entries'][0]['url'];

To display all the values you have to loop through each entries

foreach($json['responseData']['entries'] as $data)
{
  echo $data['url'];
}

Please debug the $json via print_r($json); and then check current status of array and their indexes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM