Home > other >  update a json database
update a json database

Time:07-25

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

CodePudding user response:

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)
  • Related