Created
November 14, 2015 09:42
-
-
Save jonwhittlestone/d5a94d38cb394e794045 to your computer and use it in GitHub Desktop.
Returning JSON in Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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