skillfed

flask-marshmallow

Flask + marshmallow for beautiful APIs

flask-marshmallow v1.5.0 1.5M downloads/30d#3,800 on PyPI887
Permissive license MIT Active released

What it is and what it does

Flask-Marshmallow is a lightweight bridge between Flask and marshmallow that simplifies building JSON APIs. It extends marshmallow with Flask-specific fields like URLFor and Hyperlinks, making it straightforward to generate HATEOAS-compliant responses where API resources include links to related endpoints. You define schemas as classes, then call dump() or load() on request/response data to serialize objects to JSON or deserialize incoming JSON back into Python objects with validation.

The package is designed for developers building REST APIs who want declarative, reusable schema definitions with automatic URL generation. It has no external system dependencies, installs quickly, and integrates cleanly into existing Flask applications. Optional integration with Flask-SQLAlchemy is available for ORM-backed schemas.

Use it for:

  • Serialize database models to JSON responses with automatic hyperlinking to related endpoints.
  • Validate and deserialize incoming JSON request bodies against defined schemas before processing.
  • Generate HATEOAS-compliant API responses that include self and collection links.
  • Define reusable output formats for multiple Flask routes sharing the same data model.
  • Add email, datetime, and custom field validation to Flask request handlers.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Flask-Marshmallow integrates Flask and marshmallow to serialize/deserialize Python objects into JSON with built-in support for URL generation and HATEOAS hyperlinking in APIs.

Yes. Flask-Marshmallow is a mature, actively maintained library with no known vulnerabilities, minimal dependencies, and low install friction. It solves a common Flask use case (API serialization with validation) cleanly and is widely used (top 5000 packages by downloads). Install it if you're building a Flask API and want declarative schemas with built-in HATEOAS support.

Install

flask-marshmallow on PyPI

pip

pip install flask-marshmallow

uv

uv add flask-marshmallow

poetry

poetry add flask-marshmallow

Installing flask-marshmallow

Before you install

Low friction: pure Python wheel with only two runtime dependencies (Flask and marshmallow). Active maintenance with a recent release and no known vulnerabilities.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install flask-marshmallow

from flask import Flask
from flask_marshmallow import Marshmallow

app = Flask(__name__)
ma = Marshmallow(app)

class UserSchema(ma.Schema):
    email = ma.Email()
    _links = ma.Hyperlinks({"self": ma.URLFor("user_detail", values=dict(id=""))})

user_schema = UserSchema()
data = user_schema.dump({"email": "test@example.com"})

Requires Python 3.10 or later.

Verify before relying

  • Whether Flask-SQLAlchemy integration is automatic or requires additional setup beyond what the excerpt shows.
  • Performance characteristics when serializing large collections or deeply nested schemas.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — Flask, marshmallow
Maintenance actively maintained — 120 days since the last release
Last repo commit
First released
Downloads 1,535,427/month — #3,800 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flask_marshmallow-1.5.0-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTP :: Dynamic Content

Tags

flask api serializationmarshmallow flask integrationjson schema validation flaskhateoas hyperlinkingflask object serializationapi response formattingflask data validation
rest-apischema-validationhateoas

More Dynamic Content packages