I have some JSON-code which has multiple objects in it:
[
{
\"MNGR_NAME\": \"Mark\",
\"MGR_ID\": \"M44\",
\"EMP_ID\": \"1849\"
You could use jQuery's $.each:
var exists = false;
$.each(arr, function(index, obj){
if(typeof(obj.MNGR_NAME) !== 'undefined'){
exists = true;
return false;
}
});
alert('Does a manager exists? ' + exists);
Returning false
will break the each, so when one manager is encountered, the iteration will stop.