I want to edit Json file and add data in json file
Here is my json file I got from api response -
{
"options": [
{
"enabled": false,
"definition": {
"id": "hfjhj"
},
"inputs": {
"branchFilters": "[\"+refs/heads/*\"]",
"additionalFields": "{}"
}
},
{
"enabled": false,
"definition": {
"id": "hjhgj"
},
"inputs": {
"workItemType": "Bug",
"assignToRequestor": "true",
"additionalFields": "{}"
}
}
],
"variables": {
"system.debug": {
"value": "false",
"allowOverride": true
},
"name": {
"value": "myname"
},
"last_name": {
"value": "my surname"
}
},
I want to add this in variables section in above json file in same format -
"location": {
"value": "my location"
}
I am using this to save json file -
with open("tempfile.json", "w") as outfile:
json.dump(data,outfile,indent=4)
outfile.close()
What code I need to add here to have required Json Data updated in my json file ?