how to use json
#first save a JSON file in the same directory
#in the json type {} inside also
import JSON
#getting data from the json
def get_data():
with open("json_name.json", "r") as f:
data = json.load(f)
return data
#saving data
def save_data(data):
with open("json_name.json", "w") as f:
json.dump(data, f)
#this is how we get data in json
data = get_data()
#this is how we change values in the json
data['test'] = {'name': 'Siamese'}
#this is how we save the changes in the json
save_data(data)
data = get_data()
print(data['test']['name'])
#output will be "Siamese"