how to decode this JSON string?

$array = json_decode($json, true);
$feed = $array['feed'];

Note that json_decode() already returns an array when you call it with true as second parameter.

Update:

As the value of feed in JSON

"feed":[{"href":"http://itcapsule.blogspot.com/feeds/posts/default"}]

is an array of objects, the content of $array['feed'] is:

Array
(
    [0] => Array
        (
            [href] => http://itcapsule.blogspot.com/feeds/posts/default
        )  
)

To get the URL you have to access the array with $array['feed'][0]['href'] or $feed[0]['href'].

But this is basic handling of arrays. Maybe the Arrays documentation helps you.

Leave a Comment