Search for json array for a specific attribute


Actually I want to search an attribute's value in an json array for one of its child. Now one condition is that the attribute will not be there in all the child's of the array. This is my json array.

      "column3":"testing purpose",



So presently I am working with the each loop but like this

var obj = $.parseJSON(JSON.stringify(response));
$.each(obj, function () {
    console.log("heading1", this['heading1']);

Here response comes from mserver and it is the json array

Now I want to know can I search for this attribute in the json array without using a loop in jQuery.

Based on your sample code what I understand you have is an array of objects and you want to find objects with one specific property and or value:

This will return true if the object has the property

var results= arr.filter(function(item){ return item.hasOwnProperty("column5");  });

Or you can perform additional action when you find the property:

   if (item.hasOwnProperty("column5")) {
        return item["column5"] === 'demo 01'; //or item.column5 === 'demo 01'
   return false;