flask request.get_json code example
Example 1: how to return json response in flask
from flask import jsonify
@app.route('/summary')
def summary():
d = make_summary()
return jsonify(d)
Example 2: flask api with parameter
args = request.args
print (args) # For debugging
no1 = args['key1']
no2 = args['key2']
return jsonify(dict(data=[no1, no2])) # or whatever is required