Originally posted by **aden-collector** May 21, 2024
We are using reflex version 0.5.0post1. Our code used the dict() function with by_alias=True to get a dictionary from an object of a data class. The data class inherited from rx.Base and has a few field names. This is a sample field definition: name: str = Field(alias="Name"). Function dict() worked in the past but stopped working recently. The key value in the resulting dictionary was "name" instead of the alias "Name". We heard that function dict() was deprecated so we tried using the model_dump() function with the parameter by_alias=True. We changed the data class to inherit from rx.Model instead of rx.Base. The dictionary returned by model_dump() doesn't use the alias. We have the same issue as using the dict() function (key name "name" in the dictionary instead of the alias "Name")
Discussed in https://github.com/orgs/reflex-dev/discussions/3358