以下是我的JSON
{
"mname":
[
{
"Mname":"abc",
"pname":[],
"rewards":null
}
]
}
如何检查奖励数组是否包含空值?
答案 0 :(得分:1)
试试这段代码,
var data = {
"mname": [
{
"Mname": "abc",
"pname": [],
"rewards": null
}
]
}
$.each( data.mname , function( key, value ) {
if(value.rewards == null || value.rewards == undefined){
// Add your codes/logic
}
});
答案 1 :(得分:0)
试试这个
var data = {
"mname":
[
{
"Mname":"abc",
"pname":[],
"rewards":null
}
]
}
if(data.mname[0].rewards == null || data.mname[0].rewards == undefined){
}