title: TypeError: string indices must be integers with flask json
body: <p>I am testing a flask app where I need to post some key value pairs, but  my flask app is expecting them in JSON format. At the command line I created json from my kv pairs like so:</p>
  
  <pre><code>&gt;&gt;&gt; import json
  &gt;&gt;&gt; print json.dumps({'4': 5, '6': 7}, sort_keys=True,indent=4, separators=(',', ': '))
  {
      "4": 5,
      "6": 7
  }
  </code></pre>
  
  <p>when I put this into postman:</p>
  
  <p><a href="https://i.stack.imgur.com/F1IUQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F1IUQ.png" alt="enter image description here"></a></p>
  
  <p>and post it to my app I get:</p>
  
  <pre><code>TypeError: string indices must be integers
  </code></pre>
  
  <p>However if I use:</p>
  
  <pre><code>[{
      "4": 5,
      "6": 7
  }]
  </code></pre>
  
  <p>It works! Why is this happening?</p>
  
  <p>Here is the app code. the error is happening at the last line:</p>
  
  <pre><code>json = request.get_json(force=True) # receives request from php
  for j in json:
          print str(j)
  
  test = [{'ad': j['4'], 'token':j['6']} for j in json]
  </code></pre>