I need to replace an integer in a json body:
file1.json
{
"id": 0,
"col_1": "some value",
"col_2": "another value"
}
I know to replace a string, I would use:
import json
with open('file1.json') as f:
data = json.load(f)
data["col_1"] = data["col_1"].replace("some value", "new value")
But how would I replace the id
, to the number 5 for example?