import json # Load json data with open("example.json", "r") as file: json.load(file) # Save dict to json with open("example2.json", "w") as file: data = {"numbers": [1,2,3]} json.dump(data, file, indent=2)
Here is what the above code is Doing:
1. Loads the json data from the file into a dict
2. Creates a dict with some data
3. Saves the dict to a json file