How to get the value of a nested object containing array of values

I am trying to check if a value is present in the below nested object:

var Obj = {
   "testname":"Validator",
   "dataTableName":"y",
   "dataColumnName":"y",
   "CheckFilter":"CheckBoxFilter",
   "CheckFilterSettings":{
      "values":[
         "70.00"
      ],
      "hierarchyPaths":[
         
      ]
   }
}

I tried using

for (var i in Obj) {
    if (Obj[i].CheckFilterSettings.values[0] === "70.00"){
    console.log("Value Found");
    }else{
        console.log("Value Not Found");
        }
    }

Could someone please suggest where I am going wrong.

1 thought on “How to get the value of a nested object containing array of values”

Leave a Comment