I'm trying to load a JSON response from a website into a Python (2.7) dictionary, but am getting stuck iterating through more than the outer JSON object.
E.g. the website response looks like:
{
"movies": [
{
"movieTitle": "True Lies",
"Cert": "15",
"Released": "1987",
},
{
"movieTitle": "Scary Movie",
"Cert": "18",
"Released": "1997",
},
My Python is as follows, and when printing 'json_object' I see all of the data, but how can I get the JSON array held within 'json_object' into a Python list / dictionary?
response = requests.get('https://api.foo.com/movies/all', headers=headers)
json_object = json.loads(response.text)
print json_object
json_objectis a dict;json_object["movies"]is a list. Where exactly are you having problems?