title: Python Accessing Nested JSON Data
body: <p>I'm trying to get the zip code for a particular city using zippopotam.us. I have the following code which works, except when I try to access the <code>post code</code> key which returns <code>TypeError: expected string or buffer</code></p>
  <pre><code>r = requests.get('http://api.zippopotam.us/us/ma/belmont')
  j = r.json()
  
  data = json.loads(j)
  
  print j['state']
  print data['places']['latitude']
  </code></pre>
  <p>Full JSON output:</p>
  <pre><code>{
  &quot;country abbreviation&quot;: &quot;US&quot;,
  &quot;places&quot;: [
      {
          &quot;place name&quot;: &quot;Belmont&quot;,
          &quot;longitude&quot;: &quot;-71.4594&quot;,
          &quot;post code&quot;: &quot;02178&quot;,
          &quot;latitude&quot;: &quot;42.4464&quot;
      },
      {
          &quot;place name&quot;: &quot;Belmont&quot;,
          &quot;longitude&quot;: &quot;-71.2044&quot;,
          &quot;post code&quot;: &quot;02478&quot;,
          &quot;latitude&quot;: &quot;42.4128&quot;
      }
  ],
  &quot;country&quot;: &quot;United States&quot;,
  &quot;place name&quot;: &quot;Belmont&quot;,
  &quot;state&quot;: &quot;Massachusetts&quot;,
  &quot;state abbreviation&quot;: &quot;MA&quot;
  }
  </code></pre>