My exercise idea is to append new value from the input prompt to the list. Instead of adding new value, my list in JSON file always give the newly inputted value.
import json
file = 'database.json'
namelist = []
name = input("Enter your name:\n")
with open(file, 'w') as file_object:
namelist.append(name)
json.dump(namelist, file_object)