Below is my json content
{
"demoPO":{
"login":["demoJPLog in", "demoFRLog in","GELog in"],
"cancel":["demoJPCancel", "demoFRcancelo","GEcancelo"],
"content":["demoJPcontent", "demoFRcontent","GEcontent"]
},
"demoPO2":{
"login":["JPLog in", "FRLog in","GELog in"],
"cancel":["JPCancel", "FRcancelo","GEcancelo"],
"content":["JPcontent", "FRcontent","GEcontent"],
"submit":["JPsubmit", "FRsubmit","GEsubmit"]
}
}
I want to update value of key demPO2.login[0]
data.demoPO2.login[0] = value; //this updates key - works
consider user is passing **key** as a variable
var keyName = 'demPO2.login[0]'
data[keyname] = value; //doesn't update, adds a new one
Is there a way to overcome this where user can pass key as variable and update when there are multi-level array in json?