Skip to content Skip to sidebar Skip to footer

Flask's Jsonify Function Inconsistent With Flask-marshmallow

I am developing an API using flask-RESTful and am having an issue with Flask's jsonify function. I am using flask-marshmallow for JSON serialization. Below is a very simplified cod

Solution 1:

I researched some more, and found one solution to the problem (I feel a bit silly since the solution is right in the docs), but cannot explain why the original problem happens.

The solution (found here) is to either use:

jsonify(result.data)

or:

activities_schema.jsonify(result)

Either method will return just the data, not the errors.

I still cannot explain why doing it the other way was inconsistent between the server and my local machine, but maybe that's a different question.

Post a Comment for "Flask's Jsonify Function Inconsistent With Flask-marshmallow"