xxxxxxxxxx
import json
path="......"
# get data file
with open(path) as f:
obj = json.load(f)
# add data new
obj["data"].update({"name":"M-Sakr"})
# save data new
with open(path,"w+") as of:
json.dump(obj,of)
xxxxxxxxxx
import json
path="......"
with open(path) as f:
obj = json.load(f)
obj["data"].append({"name":"hayder zaeim"})
with open(path,"w+") as of:
json.dump(obj,of)