Skip to content


Here are the typecasts available in the default repository, available as

from typecasts import casts
Source Destination Cast
int float float
bytes str functools.partial(decode, encoding=utf-8)
Dataclass NewType JSONString(str) dataclass.dataclass_to_json_string
int bytes bytes
str SubclassOf[BaseModel] pydantic.json_string_to_pydantic
float int int
BaseModel str pydantic.pydantic_to_json_string
str bytes encode
dict str json.dumps
NewType JSONString(str) SubclassOf[Dataclass] dataclass.json_string_to_dataclass


  • pydantic typecasts are only enabled if pydantic library is installed.