title: Sending JSON and status code with a Flask response
body: <p>I know I can set the status code of a response with <code>Response(status=200)</code>. How can I return JSON data while setting the status code?</p>
  
  <pre><code>from flask import Flask, Response
  
  @app.route('/login', methods=['POST'])
  def login():
      response = Response(status=200)
      # need to set JSON like {'username': 'febin'}
      return response
  </code></pre>