flask 返回json数据

ret={

  'a':1

}

return jsonify(ret)

不能直接返回ret,应该用jsonify()。这样返回的Content-Type: application/json;charset=utf-8

如果使用json.dumps(ret)返回的Content-Type: text/html

原文地址:https://www.cnblogs.com/shining5/p/12124781.html