title: How can I loop over entries in JSON?
body: <p>I want to loop over the content of a JSON file and print it to the console.</p>
  
  <p>I think I did mix up something with lists.</p>
  
  <p>This is what I tried to get all the <code>team_name</code> elements</p>
  
  <pre><code>from urllib2 import urlopen
  import json
  
  url = 'http://openligadb-json.heroku.com/api/teams_by_league_saison?league_saison=2012&amp;league_shortcut=bl1'
  response = urlopen(url)
  json_obj = json.load(response)
  
  for i in json_obj['team']:
      print i
  </code></pre>
  
  <p>And this is my JSON (simplified:)</p>
  
  <pre><code>{
      "team": [
          {
              "team_icon_url": "http://www.openligadb.de/images/teamicons/Hamburger_SV.gif",
              "team_id": "100",
              "team_name": "Hamburger SV"
          },
          {
              "team_icon_url": "http://www.openligadb.de/images/teamicons/FC_Schalke_04.gif",
              "team_id": "9",
              "team_name": "FC Schalke 04"
          }
      ]
  }
  </code></pre>
  
  <p>(Full JSON output to be found here: <a href="http://openligadb-json.heroku.com/api/teams_by_league_saison?league_saison=2012&amp;league_shortcut=bl1">Link</a>)</p>
  
  <p>And of course I get an error, that I should use integer input in [], not string, but I don't get how I could do that.</p>
  
  <pre><code>for i in json_obj['team']:
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <p>Here is the <code>response</code>:</p>
  
  <pre><code>http://openligadb-json.heroku.com/api/teams_by_league_saison?league_saison=2012&amp;league_shortcut=bl1
  &lt;addinfourl at 139755086292608 whose fp = &lt;socket._fileobject object at 0x7f1b446d33d0&gt;&gt;
  </code></pre>
  
  <p>What did I get wrong?</p>