I want to replace the values inside a json for dictionary's key it could be present as dictionay directly in json or as a dictionary inside another list as below:
{
"appType": "popper",
"createdAt": "1970-01-01T00:00:00.000Z",
"updatedAt": "1970-01-01T00:00:00.000Z",
"people": [{
"name": "Vol1",
"label": "Vol1",
"peopleInfo": [{
"name": "ram",
"age": "2407653459860",
"id": "1b738651-da9f-4c85-88c1-70dbfe1976681"
}],
"itemInfo": {
"id": "ee763970-51e2-57a5-955c-d72fc3e28a3f",
"name": "xyz",
"type": "any",
"managed": False
}
}],
"itemInfo": [{
"managed": False,
"vendorName": "any",
"serialNumber": "AF-10124"
}],
}
Desired Output:
{
"appType": "popper",
"createdAt": "1970-01-01T00:00:00.000Z",
"updatedAt": "1970-01-01T00:00:00.000Z",
"peopleInfo": [{
"name": "Vol1",
"label": "Vol1",
"people": [{
"name": "ram",
"age": "2407653459860",
"id": "1b738651-da9f-4c85-88c1-70dbfe1976681"
}],
"itemInfo": {
"id": "ee763970-51e2-57a5-955c-d72fc3e28a3f",
"name": "xyz",
"type": "any",
"managed": True
}
}],
"itemInfo": [{
"managed": True,
"vendorName": "any",
"serialNumber": "AF-10124"
}],
}
so as in desired output i want to update/replace the managed flag as True from false for itemInfo directly in json and as well as itemInfo in peopleInfo List using python. The iteminfo dictionary can be present in entire json in some different list as well. Thankyou for the help.
I have written below code but not able to make it a general one:
i["details"]["storageSystemsInfo"][0]["managed"] = True