从 json 代码中提取项目

extract item from json code

如何从此 json 代码中提取 ASIN 字段? 此代码来自亚马逊 API。其实我不知道这段代码是不是真的JSON代码

  object(stdClass)#6 (2) {
["OperationRequest"]=>
 object(stdClass)#7 (4) {
["HTTPHeaders"]=>
object(stdClass)#8 (1) {
  ["Header"]=>
  object(stdClass)#9 (2) {
    ["Name"]=>
    string(9) "UserAgent"
    ["Value"]=>
    string(15) "PHP-SOAP/5.5.22"
  }
}
["RequestId"]=>
string(36) "639b29bd-4bad-4b40-8a9a-3bd86df3d876"
["Arguments"]=>
object(stdClass)#10 (1) {
  ["Argument"]=>
  object(stdClass)#11 (2) {
    ["Name"]=>
    string(7) "Service"
    ["Value"]=>
    string(19) "AWSECommerceService"
  }
}
["RequestProcessingTime"]=>
float(0.456677)
 }
  ["Items"]=>
 object(stdClass)#12 (5) {
  ["Request"]=>
object(stdClass)#13 (2) {
  ["IsValid"]=>
  string(4) "True"
  ["ItemSearchRequest"]=>
  object(stdClass)#14 (3) {
    ["Keywords"]=>
    string(11) "Bud Spencer"
    ["ResponseGroup"]=>
    string(5) "Small"
    ["SearchIndex"]=>
    string(3) "DVD"
  }
}
["TotalResults"]=>
int(598)
["TotalPages"]=>
int(60)
["MoreSearchResultsUrl"]=>
string(232) "http://www.amazon.it/gp/redirect.html?camp=2025&creative=165953&location=http%3A%2F%2Fwww.amazon.it%2Fgp%2Fsearch%3Fkeywords%3DBud%2BSpencer%26url%3Dsearch-alias%253Ddvd&linkCode=sp1&tag=unis04-21&SubscriptionId=AKIAIGBEJI2W275RATZQ"
["Item"]=>
array(10) {
  [0]=>
  object(stdClass)#15 (3) {
    ["ASIN"]=>
    string(10) "B00OOZTAQ2"
    ["DetailPageURL"]=>
    string(200) "http://www.amazon.it/Bud-Spencer-Collezione-4-Dvd/dp/B00OOZTAQ2%3FSubscriptionId%3DAKIAIGBEJI2W275RATZQ%26tag%3Dunis04-21%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00OOZTAQ2"
    ["ItemAttributes"]=>
    object(stdClass)#16 (7) {
      ["Actor"]=>
      array(5) {
        [0]=>
        string(11) "Bud Spencer"
        [1]=>
        string(11) "Jerry Cala'"
        [2]=>
        string(16) "Stefano Mingardo"
        [3]=>
        string(14) "Kallie Knoetze"
        [4]=>
        string(5) "Gegia"
      }
      ["Author"]=>
      array(3) {
        [0]=>
        string(16) "Marcello Fondato"
        [1]=>
        string(22) "Francesco Scardamaglia"
        [2]=>
        string(13) "Rainer Brandt"
      }
      ["Creator"]=>
      array(2) {
        [0]=>
        object(stdClass)#17 (2) {
          ["_"]=>
          string(11) "Bud Spencer"
          ["Role"]=>
          string(19) "Primary Contributor"
        }
        [1]=>
        object(stdClass)#18 (2) {
          ["_"]=>
          string(11) "Jerry Cala'"
          ["Role"]=>
          string(19) "Primary Contributor"
        }
      }
      ["Director"]=>
      string(12) "Michele Lupo"
      ["Manufacturer"]=>
      string(14) "Eagle Pictures"
      ["ProductGroup"]=>
      string(3) "DVD"
      ["Title"]=>
      string(32) "Bud Spencer - Collezione (4 Dvd)"
    }
  }
  [1]=>
  object(stdClass)#19 (3) {
    ["ASIN"]=>
    string(10) "B0036A98ZO"
    ["DetailPageURL"]=>
    string(208) "http://www.amazon.it/Bud-Spencer-Terence-Hill-Monster-Box/dp/B0036A98ZO%3FSubscriptionId%3DAKIAIGBEJI2W275RATZQ%26tag%3Dunis04-21%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0036A98ZO"
    ["ItemAttributes"]=>
    object(stdClass)#20 (5) {
      ["Actor"]=>
      array(2) {
        [0]=>
        string(12) "Terence Hill"
        [1]=>
        string(11) "Bud Spencer"
      }
      ["Creator"]=>
      array(2) {
        [0]=>
        object(stdClass)#21 (2) {
          ["_"]=>
          string(12) "Terence Hill"
          ["Role"]=>
          string(24) "Collaboratore principale"
        }
        [1]=>
        object(stdClass)#22 (2) {
          ["_"]=>
          string(11) "Bud Spencer"
          ["Role"]=>
          string(24) "Collaboratore principale"
        }
      }
      ["Manufacturer"]=>
      string(26) "3L Vertriebs GmbH & Co. KG"
      ["ProductGroup"]=>
      string(3) "DVD"
      ["Title"]=>
      string(70) "Bud Spencer & Terence Hill - Monster-Box Reloaded [Edizione: Germania]"
    }
  }
  [2]=>
  object(stdClass)#23 (3) {
    ["ASIN"]=>
    string(10) "B00HSPBF2M"
    ["DetailPageURL"]=>
    string(200) "http://www.amazon.it/Bud-Spencer-Terence-Hill-Dvd/dp/B00HSPBF2M%3FSubscriptionId%3DAKIAIGBEJI2W275RATZQ%26tag%3Dunis04-21%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00HSPBF2M"
    ["ItemAttributes"]=>
    object(stdClass)#24 (7) {
      ["Actor"]=>
      array(5) {
        [0]=>
        string(17) "Luciano Catenacci"
        [1]=>
        string(11) "Bud Spencer"
        [2]=>
        string(12) "Laura Gemser"
        [3]=>
        string(12) "Terence Hill"
        [4]=>
        string(9) "Buffy Dee"
      }
      ["Author"]=>
      array(6) {
        [0]=>
        string(12) "Enzo Barboni"
        [1]=>
        string(14) "Bruno Corbucci"
        [2]=>
        string(18) "Luciano Vincenzoni"
        [3]=>
        string(14) "Mario Amendola"
        [4]=>
        string(17) "Sabatino Ciuffini"
        [5]=>
        string(15) "Sergio Corbucci"
      }
      ["Creator"]=>
      array(2) {
        [0]=>
        object(stdClass)#25 (2) {
          ["_"]=>
          string(17) "Luciano Catenacci"
          ["Role"]=>
          string(19) "Primary Contributor"
        }
        [1]=>
        object(stdClass)#26 (2) {
          ["_"]=>
          string(11) "Bud Spencer"
          ["Role"]=>
          string(19) "Primary Contributor"
        }
      }
      ["Director"]=>
      array(3) {
        [0]=>
        string(12) "Enzo Barboni"
        [1]=>
        string(15) "Sergio Corbucci"
        [2]=>
        string(14) "Bruno Corbucci"
      }
      ["Manufacturer"]=>
      string(13) "Federal Video"
      ["ProductGroup"]=>
      string(3) "DVD"
      ["Title"]=>
      string(34) "Bud Spencer & Terence Hill (3 Dvd)"
    }
  }


}
}
}

我试过像普通数组和 JSON 对象一样提取 ASIN。帮忙?

这里是我用来生成上面代码的代码:

       try
   {
   $amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'it', AWS_ASSOCIATE_TAG);

   $amazonEcs->associateTag(AWS_ASSOCIATE_TAG);

   $response = $amazonEcs->category('DVD')->search("Bud Spencer");

   $result=var_dump($response);

  }
  catch
  ...

这似乎不是 json 消息。它似乎是使用 PHP 打印出来的 json 消息。您将使用哪种语言提取信息?

<?php
   $json = '{"a":1,"b":2,"c":3}';

   //an object of type stdClass
   $result = json_decode($json);
   echo $result->a, "\r\n";
   echo $result->b, "\r\n";
   echo $result->c, "\r\n";

   //an associative array
   $result = json_decode($json, true);
   echo $result['a'], "\r\n";
   echo $result['b'], "\r\n";
   echo $result['c'], "\r\n";
?>