I try to get the DisplayValues from Json code with PHP but I can't do it.
{
"ItemInfo": {
"Features": {
"Label": "Features",
"Locale": "en_US",
"DisplayValues": [
"Vented clear cover doubles as a 6-quart capacity popcorn bowl",
"Stir rod is motorized and improves popping, get more popped corn, larger kernels per batch",
"Convenient nesting lid is ideal for small storage"
]
}
}
To get Locale I do this:
// Convert JSON string to Array
$someArray = json_decode($response, true);
$productosMaximos = count($someArray['SearchResult']['Items']);
$productosMaximosResta = ($productosMaximos - 1);
if($productosMaximos <= 8){
$productosMaximosFuncion = $productosMaximosResta;
}else{
$productosMaximosFuncion = 7 ;
}
for ($i = 0; $i <= $productosMaximosFuncion; $i++) {
echo $someArray['SearchResult']['Items'][$i]['ItemInfo']['Features']['Locale'];
}
Json code its from Amazon API 5, here are the all json that i can obtain.
{
"SearchResult": {
"Items": [
{
"ASIN": "0545162076",
"DetailPageURL": "https://www.amazon.com/dp/0545162076?tag=dgfd&linkCode=osi",
"Images": {
/* Container for Images Resources if requested*/
},
"ItemInfo": {
/* Container for ItemInfo Resources if requested */
},
"Offers": {
/* Container for Offers Resources if requested */
},
{
/* More items */
}
}
],
}
}
For more information can find here: https://webservices.amazon.com/paapi5/documentation/search-items.html If you need more information please tell me and I give you all information that i know. Thank you for the help in advance.
source https://stackoverflow.com/questions/69381545/parsing-json-with-php-amazon-api-5
Comments
Post a Comment