Parsing data from JSON with python
Question: I'm just starting out with Python and here is what I'm trying to do. I want to
access Bing's API to get the picture of the day's url. I can import the json
file fine but then I can't parse the data to extract the picture's url.

Here is my python script:

    
    
    import urllib, json
    
    url = "http://www.bing.com/HPImageArchive.aspx?    format=js&idx=0&n=1&mkt=en-US"
    response = urllib.urlopen(url)
    data = json.loads(response.read())
    
    print data
    
    print data["images"][3]["url"]
    

I get this error:

    
    
    Traceback (most recent call last):
      File "/Users/Robin/PycharmProjects/predictit/api.py", line 9, in <module>
        print data["images"][3]["url"]
    IndexError: list index out of range
    

FYI, here is what the JSON file looks like:
[http://jsonviewer.stack.hu/#http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-
US](http://jsonviewer.stack.hu/#http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-
US)


Answer: 
    print data["images"][0]["url"]
    

there is only one object in "images" array

