I want to add data in my json response from request.post in python.
From this.
{
"key" : "value"
}
To this ...
{
"key" : "value"
"metadata" : { "key1" : "value1", "key2" : "value2"
}
CodePudding user response:
You can add key and value as following
data = {
"key" : "value"
}
data["metadata"] = { "key1" : "value1", "key2" : "value2"}
CodePudding user response:
You can do it very easily:
data = response.json()
data["metadata"] = yourData
