Is there a way to traverse a JSON when the index are in a list in Python.
JSON:
{
"id" : "abc",
"Obj1":
{
"Obj1":{
"Name" : "123456789"
}
}
}
Conventionally we can access JSON index as:
data['Obj1']['Obj1']['Name'] >>Output is 123456789
But how to traverse this and change the value in same 'data' json object if the index are in a list like:
['Obj1','Obj1','Name']
Need a way to traverse to the location by using list in place of hard code index.
I need to replace the value also with 'XYZ' so final json should be "{ "id" : "abc", "Obj1": { "Obj1":{ "Name" : "XYZ" } } }"