How do I `jsonify` a list in Flask? [duplicate]
You can't but you can do it anyway like this. I needed this for jQuery-File-Upload
import json# get this objectfrom flask import Response#example data: js = [ { "name" : filename, "size" : st.st_size , "url" : url_for('show', filename=filename)} ]#then do this return Response(json.dumps(js), mimetype='application/json')
jsonify
prevents you from doing this in Flask 0.10 and lower for security reasons.
To do it anyway, just use json.dumps
in the Python standard library.