Let's say I have on object with my options: options = jQuery.extend({ title: 'xy', date: 'xy' }, opts);
And some JSON data: ({ "items": [ { "title": "IMGP3817", "date": "2008-10-18T10:35:17-08:00" }, { "title": "IMGP3826", "date": "2008-10-18T11:18:19-08:00" } ] }) Now I want to loop through each item and check for each option (e.g. with indexOf). How to do this? This doesn't work: $.getJSON("wheremydatais", function(data){ $.each(data.items, function(i,item){ $.each(options, function(key,val){ if (item.key.indexOf(options.key) != -1) { console.log('everything ok'); } }); }); });