title: Python Flask : How to convert a dictionary object to json?
body: <p>I'm fairly new to Python. So I have a REST API based on Flask.So I have a dictionary as listed below :</p>
  
  <pre><code>dict = {'left': 0.17037454, 'right': 0.82339555, '_unknown_': 0.0059609693}
  </code></pre>
  
  <p>I need to add this to my json response object which is like this :</p>
  
  <pre><code>message = {
                              'status': 200,
                              'message': 'OK',
                              'scores': dict 
                          }
                  resp = jsonify(message)
                  resp.status_code = 200
                  print(resp)
                  return resp
  </code></pre>
  
  <p>I'm getting the following error :</p>
  
  <pre><code>....\x.py", line 179, in default
      raise TypeError(repr(o) + " is not JSON serializable")
  TypeError: 0.027647732 is not JSON serializable
  </code></pre>
  
  <p>Can some one help me with this?
  Thanks.</p>