There are many post about this but I can't figure this one out. This is the json response from an Ajax function:
var obj = {
"3901": 10,
"3900": 3,
"3902": 9,
"3899": 2,
"3274": 4,
"3257": 9.5,
"3883": 12,
"3881": "12",
"3876": 3,
"3267": 14,
"3258": 2.5,
"3260": 13.5,
"3259": 6.5,
"3264": 4.5,
"3268": 2,
"3273": 5.5,
"3266": 17,
"3270": 9,
"3271": 8,
"3275": 2,
"3263": 2.5,
"3261": 2.5,
"3265": "37",
"3281": 3,
"3277": 7.5,
"3278": 0.5,
"3276": 7,
"3898": 8,
"3891": 7,
"3293": 1,
"3895": 1,
"3256": 2,
"3903": 10,
"3840": 2,
"3886": 11,
"3884": 8,
"3872": 2,
"3874": 4,
"3284": 1.5,
"3302": 1.25,
"3304": 5,
"3306": 2,
"3329": 1.5,
"3330": 2,
"3333": 6,
"3335": 7.5,
"3327": 1,
"3934": 8,
"3935": 9,
"3939": 1,
"3933": 3,
"3937": 1,
"3322": 3.5,
"3890": 1,
"3878": 5,
"3880": 4,
"3879": 1,
"3889": 2,
"3852": 2,
"3877": 2
}
I have a this of ids: 3902, 3883, 4567 and 3878
All I need is to loop through the those 4 ids and check if those are in the json response and if they are get the value associated to it and if not return 0. For example:
3902 will return 9 and 4567 will return 0
Thanks.