I want to completely empty a JSON file, while still keeping the file. How do I do that? I tried:
with open("Screentime/activities.json", "w") as f:
json.dump("", f, indent=4, sort_keys=True)
with open("Screentime/activities.json", "w") as f:
json.dump({}, f, indent=4, sort_keys=True)
, etc but none of them work. Please help me out! Ive seen answers on how to delete keys in the JSON, or delete the entire file, but not how to just replace it with nothing.