Python Projects & Skills / Files and data
Lesson 12 of 28
JSON
JSON is the most common format for sending data between programs and websites. json.dump saves Python data and json.load reads it back.
Key points
- Looks like Python dicts and lists
- json.dumps makes a string
- Used by almost every web API
import json
data = {"user": "lazo", "level": 3}
with open("save.json", "w") as f:
json.dump(data, f)Quiz · +10 XP
Which function writes Python data to a JSON file?
Log in to save progress and earn XP.