I have to change an attribute of a JSON object. Ex.
allOppList= [[{"A":"2051-11-21","B":"FLOAT"}]]
I have to change the B to "xyz" in the JS file.
I am doing by below code but I am not able to update the B element
let tempAllRecords = Object.assign([], this.allOppList);
for (let j = 0; j < this.allOppList.length; j++) {
let tempRec = Object.assign({}, tempAllRecords[j]);
tempRec.B = event.detail.checked;
tempAllRecords[j] = tempRec;
}
this.allOppList = tempAllRecords;
in this way, "B" of allOppList
is not getting updated. Instead, it is getting updated like below
allOppList= [[{"A":"2051-11-21","B":"FLOAT"},"B":"New value"]]