Updated the Pydantic Serialization Tutorial documentation accordingly to the new API by replacing the .dict() and .json() by the new ones. Additionally changed __root__ attribute by root from the new RootModel.
Description
Methods .json() and .dict were deprecated in the new Pydantic V2 API, this changes aims to change the related pydantic documentation regarding Pydantic Serialization Tutorial to the new methods.
Regarding the __root__ field, since they decoupled the "custom root model" with the new type RootModel, that usage was changed in documentation as well.
Updated the Pydantic Serialization Tutorial documentation accordingly to the new API by replacing the
.dict()
and.json()
by the new ones. Additionally changed__root__
attribute byroot
from the newRootModel
.Description
Methods
.json()
and.dict
were deprecated in the new Pydantic V2 API, this changes aims to change the related pydantic documentation regarding Pydantic Serialization Tutorial to the new methods.New methods replacements are:
.dict()
→.model_dump()
.json()
→.model_dump_json()
See migration guide.
Regarding the
__root__
field, since they decoupled the "custom root model" with the new type RootModel, that usage was changed in documentation as well.Motivation and Context
Pydantic Migration Guide
How Has This Been Tested?
N/A
Checklist: