update a json database
Question:
I wanted to create a sort of database in json with python, but I don’t know how to delete existing "value"
{
{ "object" :
{ "object_id" : 012345678}}
}
and if the user create a new object with the same object name, but a different object I’d value, it will update.
sorry for my bad explanation
Answers:
If you are using the JSON library and trying to update data after you have added data with Python then you can use this
data = # adding stuff to the json file using json library
with open("file.json", "w") as f:
json.dump(data, f)
I wanted to create a sort of database in json with python, but I don’t know how to delete existing "value"
{
{ "object" :
{ "object_id" : 012345678}}
}
and if the user create a new object with the same object name, but a different object I’d value, it will update.
sorry for my bad explanation
If you are using the JSON library and trying to update data after you have added data with Python then you can use this
data = # adding stuff to the json file using json library
with open("file.json", "w") as f:
json.dump(data, f)