title: KeyError In Python With json.dumps
body: <p>I'm trying to work with dictionaries inside a list in a JSON file. The data imports fine and reads fine. For the life of me I can't figure out how to printout the "member_id" keys. I just want to print the list of "member_id" numbers. I was initially using json.loads, then switched to json.dumps. Any help would really be appreciated.</p>
  
  <pre><code>import urllib2
  import json
  nyt_api_key = '72c9a68bbc504e91a3919efda17ae621%3A7%3A70586819'
  url= 'http://api.nytimes.com/svc/politics/v3/us/legislative/congress/113'
  json_obj = urllib2.urlopen(url)
  data = json.load(json_obj)
  data2 = json.dumps(data, sort_keys=True, indent=True, skipkeys = True)
  
  print data2
  </code></pre>
  
  <p>Output from <code>print data2</code>: (The list goes on and on so it is truncated. There is a closing bracket at the bottom of the list. So it's dictionaries within a list.)</p>
  
  <pre><code> "positions": [
   {
    "dw_nominate": "0.466", 
    "member_id": "A000055", 
    "vote_position": "Yes"
   }, 
   {
    "dw_nominate": "0.995", 
    "member_id": "A000367", 
    "vote_position": "Yes"
   }, 
   {
    "dw_nominate": "0.666", 
    "member_id": "A000369", 
    "vote_position": "Yes"
   }, 
  </code></pre>
  
  <p>Output from <code>print data2['member_id']</code>, output is the same if using 'positions', 'vote_position', etc.: </p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/Owner/PycharmProjects/untitled2/1", line 9, in &lt;module&gt;
      print data2["positions"]
  TypeError: string indices must be integers, not str
  </code></pre>
  
  <p>Output from <code>print data</code>: </p>
  
  <p><code>u'positions': [{u'dw_nominate': u'0.466', u'vote_position': u'Yes', u'member_id': u'A000055'}, {u'dw_nominate': u'0.995', u'vote_position': u'Yes', u'member_id': u'A000367'}, {u'dw_nominate': u'0.666', u'vote_position': u'Yes', u'member_id': u'A000369'}</code></p>
  
  <p>Output from <code>print data['positions']</code>:</p>
  
  <p><code>print data["positions"]
  KeyError: 'positions'</code></p>
  
  <p>Output from <code>print.data(keys)</code>:</p>
  
  <pre><code>[u'status', u'results', u'copyright']
  
  Process finished with exit code 0
  </code></pre>