I want to add a value to a json list with python. The json file looks like this:
{
"values": [323123]
}
The python code looks like this:
import json
#any number
id = 1234
with open("values.json", "r+") as file:
data = json.load(file)
change = data["values"].append(id)
json.dump(change, file)
and i want to make it look like this:
{
"values": [323123, 1234]
}
But the code results in this:
{
"values": [323123]
}null