Currently, I am struggling to update the values of keys within an array of objects. The JSON structure of the object I'm working with is quite intricate, with each object in the array potentially containing a different number of keys. Here is a simplified version of the JSON:
var payload = {
"data": {
"form_values": {
"70f9": [
{
"form_values": {
"6949": "drop"
},
},
{
"form_values": {
"6949": "drop"
},
},
{
"form_values": {
"6949": "drop"
},
}
],
},
}
}
I have attempted to change the 'drop' values to 'active' as shown below:
for (var i = 0; i < payload.data.form_values['70f9'].length; i++ ){
var payload.data.form_values['70f9'][i].form_values['6949'] = 'active'
}
Usually, this approach works fine, but for some reason, it is giving me trouble this time.