var days = new Array("sun", "mon", "tue", "wed", "thu", "fri", "sat");
$.each(data, function (i, object) {
$.each(object, function (property, value) {
var propertyString = getPropertyAsString(property);
if ($.inArray(propertyString, days) != -1)
{
// do something
}
count++;
});
});
以上是我用来使用 jQuery 从 json 中检索数据的代码存根。我想要做的是获取“property
名称”(我已经getPropertyAsString()
在嵌套中使用它$.each()
作为字符串标记它,然后我想检查这个“属性名称”是否存在于天数组中。
更具体地说,下面是json:
[{
"STID": 0,
"VRNO": 0,
"VRNOA": 0,
"VRDATE": "\/Date(-62135596800000)\/",
"PARTY_ID": null,
"BILTY_NO": null,
"BILTY_DATE": "\/Date(-62135596800000)\/",
"RECEIVED_BY": null,
"TRANSPORTER_ID": null,
"REMARKS": null,
"Year_srno": 0,
"ETYPE": null,
"NAMOUNT": 0,
"UID": 0,
"ORDER_VRNO": 0,
"FREIGHT": 0,
"PARTY_ID_CO": null,
"SALEBILLNO": 0,
"DISCP": 0,
"DISCOUNT": 0,
"CURRENCY_ID": 0,
"EXPENSE": 0,
"COMPANY_ID": 0,
"VEHICLE_ID": null,
"PARTY_NAME": null,
"isEditted": false,
"isDeleted": false,
"isNew": false,
"Mon": "0",
"Tue": "0",
"Wed": "0",
"Thu": "500",
"Fri": "0",
"Sat": "0",
"Sun": "0"
}]
我想做的是在最后得到工作日的值,即周一、周二、周三、周四、周五、周六、周日
我一直在尝试和尝试,但找不到方法。如果有解决方法,请建议我。