Data Science

marshmallow – object serialization and data validation

marshmallow is a library for converting complex application objects into simpler data structures and transforming incoming data into validated application values. It combines serialization, deserialization and validation through a common schema interface.

Schemas describe how individual fields should be processed and which restrictions should apply to their values. This is particularly useful for web APIs, where data must be converted between external representations and internal application objects while preserving predictable behaviour.

The library is independent of any particular object-relational mapper, database or web framework. Developers can use it with plain application classes and adapt it to different storage or transport mechanisms.

marshmallow also provides hooks for applying additional processing before or after serialization and deserialization. Complex structures can be represented through nested schemas, allowing data models to be assembled from smaller reusable definitions.

This is free and open source software.

Key Features

  • Define declarative schemas using fields with configurable constraints.
  • Deserialize input data into validated application values.
  • Serialize application objects into dictionaries and other simple structures.
  • Validate strings, numbers, dates, collections and other common data types.
  • Define custom fields and application-specific validation functions.
  • Represent nested objects using reusable schemas.
  • Handle collections of records through the many option.
  • Configure required fields, missing values and field defaults.
  • Include, exclude or reject unknown input fields.
  • Support partial updates where some required fields may be omitted.
  • Use processing hooks to transform data before or after loading and dumping.
  • Provide structured validation errors associated with individual fields.

Website: github.com/marshmallow-code/marshmallow
Support:
Developer: Steven Loria and contributors
License: MIT License

marshmallow is written in Python. Learn Python with our recommended free books and free tutorials.


Related Software

Python Data Validation
PydanticData validation using Python type hints
panderaFramework for precision data testing
jsonschema
Implementation of JSON Schema for Python
CerberusLightweight and extensible data validation library
schemaLibrary for validating Python data structures
GXValidating, documenting, and profiling data
marshmallowORM/ODM/framework-agnostic library
VoluptuousPython data validation library
SchematicsCombine types into structures, validate , and transform the shapes of data
ColanderSerialization / deserialization / validation library
ValideerLightweight data validation and adaptation Python library
OpenRefineDesktop program for data cleanup and transformation
Soda CoreData quality and data contract verification engine
OpenMetadataUnified metadata platform
Elementary OSS dbt-native data observability command-line tool

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.