Flask API TypeError: Object of type 'Response' is not JSON serializable
Inspired from this bug, here is a shorter way of doing it:
from flask import jsonify, make_responsedef myMethod(): .... return make_response(jsonify(data), 200)
This can be simply done by:
from flask import jsonifydef myMethod(): .... response = jsonify(data) response.status_code = 200 # or 400 or whatever return response
I had a similar problem, the problem is that i was using jsonify twice (jsonify(jsonify({abc:123}))
)