title: Flask POST not retrieved by request.json
body: <p>I would like to create a REST-Api using Flask.
  As a "frame" I found this <a href="http://blog.miguelgrinberg.com/post/restful-authentication-with-flask" rel="nofollow">Tutorial</a> which seemed to be really good about creating a REST-API using Flask and it also seems to be easy...</p>
  
  <p>I have this function:</p>
  
  <pre><code>@app.route('/api/users', methods=['POST'])
  def new_user():
      username = request.json.get('username')
      password = request.json.get('password')
  </code></pre>
  
  <p>But when I try to post data using SOAPUI or HTTPRequester (in Firefox) I always get a server error 500</p>
  
  <p>My application/json data looks like this:</p>
  
  <pre><code>{
   'username' : 'John',
   'password' : '1234'
  }
  </code></pre>
  
  <p>And I checked that in both tols it is sent as application/json.</p>
  
  <p>So I inserted the following before the request.json:</p>
  
  <pre><code>if not request.json:
      abort(400)
  </code></pre>
  
  <p>And now it aborts with code 400 - so it seems not to be a json object, right?</p>
  
  <p>Then I inserted the following lines:</p>
  
  <pre><code>test = request
  print test.data
  </code></pre>
  
  <p>Then I retrieve this in the console which looks tome like JSON:</p>
  
  <pre><code>{
      'username' : 'John',
      'password' : '1234'
  
      }
  </code></pre>
  
  <p>I know I could transform that into a dictionay using this:</p>
  
  <pre><code>dict = ast.literal_eval(test.data)
  </code></pre>
  
  <p>But I would like to use the standard functonality from flask.</p>
  
  <p>Thank you in advance...</p>