I can match a single property easy enough
var peoples = [
{ "name": "bob", "dinner": "pizza" },
{ "name": "john", "dinner": "sushi" },
{ "name": "larry", "dinner": "hummus" },
{ "name": "john", "dinner": "pie" }
];
$.each(peoples, function(i, val) {
$.each(val, function(key, name) {
if (name === "john")
console.log(key + " : " + name);
});
});
But since there are 2 johns how do I match a particular one (eg the john that like sushi) and then return the whole matched object (in json)? I tried adding another condition to the if statement but that didn't seem to work.
Thanks