Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample of Flask receiving JSON
# If /json route receives header "application/json"
@app.route("/json", methods=['GET','POST'])
def json():
app.logger.debug("JSON received...")
if request.json:
mydata = request.json # will be
return "Thanks. Your age is %s" % mydata.get("age")
return "no json received"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment