I'm having trouble parsing this request. It looks like this:
{"randomnumber": {"id":blah, "name":blah, ... }, "randomnumber22": { ... }}
Using python requests, I retrieve the url that returns that data, and decode it so I can try to loop through the fields. I then endup with something like:
{u'randomnumber': {u'id':u'blah', ... }, u'randomnumber22': { .. }}
And when I try to use a for-loop to stroll through the data, it complains that I need to use numbers for string indices. How can I handle this problem properly?
My simplified code:
import requests
network = requests.get('http://example.com')
networkoffers = network.json()
for offers in networkoffers:
offer['name']
So I'm trying to access network['randomnumber']['name'], going by my initial example of the request data.