If you post JSON with content type application/json
, use request.get_json()
to get it in Flask. If the content type is not correct, None
is returned. If the data is not JSON, an error is raised.
@app.route("/something", methods=["POST"])
def do_something():
data = request.get_json()