Skip to content

Instantly share code, notes, and snippets.

@jonwhittlestone
Created November 14, 2015 09:42
Show Gist options
  • Save jonwhittlestone/d5a94d38cb394e794045 to your computer and use it in GitHub Desktop.
Save jonwhittlestone/d5a94d38cb394e794045 to your computer and use it in GitHub Desktop.
Returning JSON in Flask
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/")
def index():
data = {
"header": [
"Date",
"Payment Id"
],
"data": [
[
"21/11/15",
"XXXXXXX"
]
]
};
return jsonify(data);
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment