json
Read and write JSON — the standard format for APIs and config files.
Beginner
import json
data = json.loads('{"v": 3.3}')
text = json.dumps(data, indent=2)
with open("cfg.json") as f: cfg = json.load(f)
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.