PHP JSON Decode

Discussion in 'PHP' started by greatlogix, May 26, 2008.

  1. #1
    I have long php variable after decoding JSON string using json_decode function.

    object(stdClass)#1 (3) {
    ["responseData"]=>
    object(stdClass)#2 (2) {
    ["results"]=>
    array(4) {
    [0]=>
    object(stdClass)#3 (8) {
    ["GsearchResultClass"]=>
    string(10) "GwebSearch"
    ["unescapedUrl"]=>
    string(32) "http://www.example.com/Home/"
    ........

    What should be the php syntax to access highlighted portion of string/array.

    i want to access value of this variable ["unescapedUrl"]

    Please help.
     
    greatlogix, May 26, 2008 IP
  2. Dagon

    Dagon Active Member

    Messages:
    122
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    $unescapedurl = $variable->responseData->results[0]->unescapedUrl;
     
    Dagon, May 27, 2008 IP