我正在尝试集成快递服务公司的api。在此api返回json解析数组,这是多维数组。我要检查的是,如果值是“ yes”或只是“ Y”,则数组中是否包含少量参数或元素
var d = JSON.parse(response);
$("#response").html(d);
$.each(d, function(index, el) {
console.log("Output");;
});
{
"delivery_codes": [
{
"postal_code": {
"district": "Ujjain",
"pin": 456010,
"max_amount": 0,
"pre_paid": "Y",
"cash": "Y",
"pickup": "Y",
"repl": "Y",
"cod": "Y",
"sort_code": "UJJ/SAK",
"is_oda": "N",
"state_code": "MP",
"max_weight": 0
}
}
]
}
我得到的控制台错误是
TypeError:无法使用“ in”运算符在“ {{delivery_codes ...””中搜索“ length”