[Solved] JSONObject how to change value depend on key value? [closed]


As fas as I understand your problem statment, are you looking for something like this?

var data = [
    {
        "pages": "foo1",
        "hasil": ""
    },
    {
        "pages": "foo2",
        "hasil": ""
    },
    {
        "pages": "foo3",
        "hasil": ""
    },
    {
        "pages": "foo4",
        "hasil": ""
    },
    {
        "pages": "foo5",
        "hasil": ""
    },
    {
        "pages": "foo6",
        "hasil": ""
    }
];

for(let key in this.data){
  if(this.data[key].pages == 'foo1'){
    this.data[key].hasil="hello";
  }
}
console.log(data);

solved JSONObject how to change value depend on key value? [closed]