Working with JSON in Python — a practical guide to Python JSON with clear examples you can reuse in real projects.
Python Tutorial Series (41/95). Prefer one article? Read the complete Python tutorial.
Short description
JSON maps naturally to Python dicts/lists. Use `json.dumps` / `json.loads` and file helpers.
JSON encode/decode
import json
data = {'name': 'Asha', 'skills': ['python', 'sql']}
text = json.dumps(data, indent=2)
print(text)
print(json.loads(text)['name'])