json.dump python example
Example 1: python json dump to file
import json
with open('data.json', 'w') as f:
json.dump(data, f)
Example 2: what is json loads and dumps simple
loads() takes in string and returns a json object.
dumps() takes in json object and returns a string.
Also remember.
Serialization - converts python to json
Deserialization - Converts json to python.
Example 3: python json dump
import json
with open("data_file.json", "w") as write_file:
json.dump(data, write_file)