Flask Marshmallow/SqlAlchemy: Serializing many-to-many relationships Flask Marshmallow/SqlAlchemy: Serializing many-to-many relationships flask flask

Flask Marshmallow/SqlAlchemy: Serializing many-to-many relationships


In your BookSchema, you'll want to add a Nested authors field like you had (but commented out) but you'll want to specify that it will be a list by using the many keyword argument.

class BookSchema(ma.ModelSchema):    # A list of author objects    authors = ma.Nested(AuthorSchema, many=True)    class Meta:        model = Book