FastAPI 0.140.9 Patches `jsonable_encoder` and Updates Dependencies

FastAPI · 28 Jul 2026 · 2 min read

#fastapi

FastAPI 0.140.9 is a patch release aimed at fixing a subtle bug in the jsonable_encoder utility and updating a few internal dependencies. The update ensures more predictable serialization behavior and keeps the project's toolchain up to date.

Concrete Changes

  • Bug Fix: exclude_defaults not propagated to dict keys and values in jsonable_encoder. PR #16043 by @MBGrao.
    • Previously, when using jsonable_encoder with exclude_defaults=True, the setting was applied to top-level fields but not to nested dictionaries' keys and values. This fix ensures that default values are correctly excluded from all dict-like structures within the encoded output.
  • Dependency Bumps:
    • gitpython from 3.1.50 to 3.1.54: Addresses security and bug fixes in the Git library used internally by FastAPI's development tooling.
    • pymdown-extensions from 10.21.3 to 11.0: Major version bump with performance improvements and new features for Markdown rendering in documentation.
    • pyasn1 from 0.6.3 to 0.6.4: Minor update with fixes to ASN.1 library used indirectly through cryptography.

Why This Matters

The jsonable_encoder is a core utility in FastAPI for converting complex types (like Pydantic models, datetimes, etc.) into JSON-compatible types. The exclude_defaults parameter is commonly used to reduce payload size by omitting fields that have their default values. The bug meant that nested dict structures (e.g., a model with a dict field containing default values) would still include those defaults, leading to larger-than-expected payloads. This fix restores consistency and helps developers ship leaner APIs. Additionally, keeping dependencies updated reduces security risks and leverages performance improvements.

Source: https://github.com/fastapi/fastapi/releases/tag/0.140.9

Related

auto-curated · source linked above ← all news