Lesson 5 of 7
JSON: the language of APIs
REST APIs answer in JSON. json.loads(text) converts it into Python structures: nested dictionaries and lists.
You then navigate naturally: data["results"][0]["name"]. The payload is provided here — the processing is identical to a real HTTP response.
import json data = json.loads(payload) print(data["results"][0]["name"])
🎯 Exercise
Parse PAYLOAD with json.loads into data. Store in first the name of the first result, and in active_count the number of results whose "active" is True. Print first.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →