Skip to content

Instantly share code, notes, and snippets.

Forked from johnschimmel/
Created May 26, 2017 17:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tarvos21/6cf0dee3e54bee8b98369255b8969c74 to your computer and use it in GitHub Desktop.
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