You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The obj value that's missing is the instance. You need to use an instantiated Schema:
db.MyModel.Schema().dumps(someInstanceOfMyModel)
I think that the interface of the dumped data from that will vary depending on whether you have marshmallow 2.x or 3.x installed. There was a breaking api change between the two. My project uses marshmallow 2.x so I'm used to doing this to get the dumped data:
data, errors=db.MyModel.Schema().dumps(someInstanceOfMyModel)
# data will the serialized object, errors will be any errors encountered during serialization
The current docs do not give an example of serialization support for JSON.
I attempted to use Marshmallow's dumps feature
But received an error. I am currently using
someInstanceOfMyModel._raw
to get the data for JSON output.Feature Request
Add a expose a dumps method to get a dict.
The text was updated successfully, but these errors were encountered: