For example, I have data like this
data = {
code:1,
status: 200,
data:[{
name: {
first: 'first',
last: 'last',
},
age: 12,
address: "address",
...
},
...
,{
...
}]
}
key = 'data[0].name.last';
I want to change the value data.data[0].name.last
and I know last value's path(key) is data[0].name.last
.
data[key] = 'last1'
doesn't work because of array index.
Is there any method to solve this problem?