Skip to content
masterclass Buddy

Pydantic · Class

PlainSerializer

PlainSerializer uses a function to change how an annotated value is serialized. It can declare the output type and run only in selected serialization modes.

Last updated

Syntax

PlainSerializer(func, *, return_type=..., when_used='always')

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • WrapSerializer
  • field_serializer
  • model_serializer
  • SerializationInfo

Source: Functional Serializers. Checked 2026-11-03.