First of all take a look at my json structure
{
"some_id": [
{
"embed": False,
"plain_msg": "Some text",
"embed_text": [
{
"title": "any title",
"body": "any bpdy text",
"color": "random color"
}
]
}
]
}
Lets say I have a json file as filename.json with the given json. Now I want to change value of embed without changing any other data.
I have a simple code
with open('filename.json', 'r') as f:
json_data = json.load(f)
json_data['some_id'] = 'Some string'
with open('filename.json', 'w') as f:
json.dump(json_data, f, indent=2)
But this code can only write inside some_id and rewrite all value with the given string as
{
"some_id": "Some string"
}
Please help me how can I do this! I need your help