JSON Files

Working with JSON data

Interview Relevant: Common data format

JSON Handling

Code Examples

python
1import json
2data = {"name": "Alice", "age": 25}
3
4# Write
5with open("data.json", "w") as f:
6    json.dump(data, f)
7
8# Read
9with open("data.json", "r") as f:
10    loaded = json.load(f)

AI Tutor

Ask about the topic

Sign in Required

Please sign in to use the AI tutor

Sign In