Marshmallow is a lightweight library for converting complex datatypes to and from native Python datatypes. The current version is 4.2.3, released on March 28, 2026. It follows a regular release cadence, with updates approximately every few months.
pip install marshmallowVerified import paths — ran on the pinned version, not inferred.
A simple example demonstrating how to define a schema and load data using Marshmallow.
Add 'ordered = True' in the Meta class of your schema.
Add 'unknown = INCLUDE' in the Meta class of your schema to include unknown fields.
To fix this, either define the 'unknown' option in your Schema's `Meta` class to `EXCLUDE` or `INCLUDE`, or ensure your input data only contains fields explicitly defined in the schema.
Ensure that all fields marked as `required=True` in your schema are present in the data being loaded.
Ensure you are using your Marshmallow schema's `.dump()` method to serialize complex Python objects into a dictionary of JSON-serializable types (like strings, numbers, booleans, lists, and dicts) before attempting to JSON-encode them with `jsonify` or `json.dumps()`. Alternatively, configure custom JSON encoders for specific types if not using Marshmallow for that particular object.
When defining a list of nested objects in a Marshmallow schema, wrap the nested Schema class with `fields.Nested()`. For example, use `my_list_field = fields.List(fields.Nested(MyNestedSchema))`.