from flask import json

@app.route('/summary')
def summary():
    data = make_summary()
response = app.response_class(response=json.dumps(data), status=200,
    mimetype='application/json')
return response
Return JSON response from Flask view