You need to use use_enum_values option of model config:
use_enum_valueswhether to populate models with the
valueproperty of enums, rather than the raw enum. This may be useful if you want to serialisemodel.dict()later (default:False)
from enum import Enum
from pydantic import BaseModel
class S(str, Enum):
am='am'
pm='pm'
class K(BaseModel):
k:S
z:str
class Config:
use_enum_values = True # <--
a = K(k='am', z='rrrr')
print(a.dict())