无法使用 json 对象提醒 offerid

unable to alert offerid using json object

我正在尝试提醒 offerId 但无法打印它 尝试使用 json stringify 和 json.parse 但无法正常工作,产品下的优惠 ID 应该在提醒中打印 请建议,如果我可以提醒offerId 问题就迎刃而解了

{
"result": {
    "kind": "content#productsCustomBatchResponse",
    "entries": [
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 0,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15783",
                "offerId": "15783",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        },
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 1,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15831",
                "offerId": "15831",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        },
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 2,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15846",
                "offerId": "15846",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        }
    ]
},
"body": "{\n  \"kind\": \"content#productsCustomBatchResponse\",\n  \"entries\": [\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 0,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15783\",\n        \"offerId\": \"15783\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    },\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 1,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15831\",\n        \"offerId\": \"15831\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    },\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 2,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15846\",\n        \"offerId\": \"15846\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    }\n  ]\n}\n",
"headers": {
    "cache-control": "private",
    "content-encoding": "gzip",
    "content-length": "231",
    "content-type": "application/json; charset=UTF-8",
    "date": "Wed, 04 May 2022 09:52:42 GMT",
    "server": "ESF",
    "vary": "Origin, X-Origin, Referer"
},
"status": 200,
"statusText": null }

Javascript代码

function execute() {

return gapi.client.content.products.custombatch(<?php echo json_encode($product_data,JSON_PRETTY_PRINT); ?>).then(function(response) 
{  //not working    alert(response.result[2]);  //alert response.status is working alert(response.status);   });
//Please Try This

  var data =  {
"result": {
    "kind": "content#productsCustomBatchResponse",
    "entries": [
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 0,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15783",
                "offerId": "15783",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        },
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 1,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15831",
                "offerId": "15831",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        },
        {
            "kind": "content#productsCustomBatchResponseEntry",
            "batchId": 2,
            "product": {
                "kind": "content#product",
                "id": "online:en:IN:15846",
                "offerId": "15846",
                "contentLanguage": "en",
                "targetCountry": "IN",
                "channel": "online"
            }
        }
    ]
},
"body": "{\n  \"kind\": \"content#productsCustomBatchResponse\",\n  \"entries\": [\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 0,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15783\",\n        \"offerId\": \"15783\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    },\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 1,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15831\",\n        \"offerId\": \"15831\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    },\n    {\n      \"kind\": \"content#productsCustomBatchResponseEntry\",\n      \"batchId\": 2,\n      \"product\": {\n        \"kind\": \"content#product\",\n        \"id\": \"online:en:IN:15846\",\n        \"offerId\": \"15846\",\n        \"contentLanguage\": \"en\",\n        \"targetCountry\": \"IN\",\n        \"channel\": \"online\"\n      }\n    }\n  ]\n}\n",
"headers": {
    "cache-control": "private",
    "content-encoding": "gzip",
    "content-length": "231",
    "content-type": "application/json; charset=UTF-8",
    "date": "Wed, 04 May 2022 09:52:42 GMT",
    "server": "ESF",
    "vary": "Origin, X-Origin, Referer"
},
"status": 200,
"statusText": null }

data.result.entries.map(myFunction);
function myFunction(num) {
 alert(num.product.offerId);
}