Python: Difference between revisions
Line 279: | Line 279: | ||
# Decode/Parse | # Decode/Parse | ||
json.loads("{}") | json.loads("{}") | ||
# Write to file | |||
with open("my_data.json", "w") as f: | |||
json.dump(my_data, f) | |||
# Read from file | |||
with open("my_data.json", "r") as f: | |||
my_data = json.load(f) | |||
</syntaxhighlight> | </syntaxhighlight> | ||