I have a dictionary that maps one key to multiple values and I want to send that dict as a json file for the user to download.
@app.route('/test', methods=['GET','POST'])
def test():
data=dict()
foods=['burger','hotdog']
foods2=['fries','chips']
data['John']=foods
data['Ken']=foods2
nutrition=jsonify(data)
return Response(nutrition,
mimetype='application/json',
headers={'Content-Disposition':'attachment;filename=nutrition.json'})
Followed solution to a similar post, however I get an error of:
TypeError: 'Response' object is not iterable
I have also tried sending data
as a parameter to Response
, with no avail. Can someone explain what I'm doing wrong.