File IO - JSON
- serializing
- deserializing
import json
x = ['pizza', 'taco', 'sushi']
json.dumps(x)
Write JSON to a file:
with open('data.json', 'w', encoding="utf-8") as f:
json.dump(x, f)
Read JSON from a file:
with open('workfile', 'r', encoding="utf-8") as f:
x = json.load(f)