Skip to content

Instantly share code, notes, and snippets.

@pathunstrom
Created March 8, 2018 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pathunstrom/018aa28ce623a5f9fb79d49a9c75ffbd to your computer and use it in GitHub Desktop.
Save pathunstrom/018aa28ce623a5f9fb79d49a9c75ffbd to your computer and use it in GitHub Desktop.
simple example how to handle json in Flask
from flask import Flask, render_template_string, jsonify, request
app = Flask("jsontest")
@app.route("/post", methods=["POST"])
def post():
return jsonify(request.json)
@app.route("/")
def home():
return render_template_string("<html><head></head><body><h1>Hello World!</body></html>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment