title: Parsing JSON file with Python -> google map api
body: <p>I am trying to get started with JSON in Python, but it seems that I misunderstand something in the JSON concept. I followed the <a href="http://code.google.com/apis/maps/documentation/webservices/index.html#ParsingJSON" rel="nofollow">google api example</a>, which works fine. But when I change the code to a lower level in the JSON response (as shown below, where I try to get access to the location), I get the following error message for code below:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):<br>
    File "geoCode.py", line 11, in<br>
    <code>&lt;module&gt;</code><br>
        test = json.dumps([s['location'] for s in jsonResponse['results']],
    indent=3) KeyError: 'location' </p>
  </blockquote>
  
  <p><strong>How can I get access to lower information level in the JSON file in python?</strong> Do I have to go to a higher level and search the result string? That seems very weird to me? </p>
  
  <p>Here is the code I have tried to run:</p>
  
  <pre><code>import urllib, json
  URL2 = "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&amp;sensor=false"
  googleResponse = urllib.urlopen(URL2);
  jsonResponse = json.loads(googleResponse.read())
  test = json.dumps([s['location'] for s in jsonResponse['results']], indent=3)
  print test
  </code></pre>