javascript : check if JSON object exists in array -
Thought that it would be easy, but this is not ... I am trying to check that, for example , This Json object:
var strs = {strprop: "VALUE_A", strsub: "VALUE_B", subsub: "VALUE_C"}
an array regroup
is present in
thanks
edit
restructuring
has this data:
[{"strprop": "repand", "strub": "au bassik suvant:", "subscribe ":" Economyir son Carburant. "}, {" Keyword ":" Koine Cher "}, {" StropProp ":" Reports "," Strussb ":" Au Basic Sevent: "," Subsub ":" Economyir son Carburant. " }, {"Keyword": "carburant pollute"}]
No normal Available methods for comparing objects in JS with other methods of the object. JSON.stringify (obj1) === JSON has suggested in this script instead of .stringify (obj2)
In your case, for
(var i = 0; i & lt; regroup.length; i ++) {// if there is an array in each object with repeated medium (JSON.stringify (Restructuring [i]) === JSON.stringify (strs) {warning ("equals"); }}
FYI: The key / value pair command Similar < / Strong> and otherwise the above method will fail.
Comments
Post a Comment