promptdojo_

GET, status, JSON — the call AI makes 100 times a day — step 3 of 9

response.json() is just a Python dict

Every real API call ends the same way: you parse the body and dig into a nested dict.

The pattern AI uses constantly:

  • data["name"] — top-level field
  • data["roles"][0] — first item of a list field
  • data["org"]["slug"] — nested dict access

If the field is missing, you get a KeyError. If a list is empty, you get an IndexError. Both are common in the wild — APIs add and remove fields between versions, and AI code rarely accounts for that.

Run the editor. Three different access patterns on the same user shape.

read, then continue.