Docs
General
Types
Codegen
Extensions
>Errors
>Guides
Editor integration
Concepts
Integrations
Federation
Operations
Convert to Dictionary
Strawberry provides a utility function to convert a Strawberry object to a dictionary.
You can use strawberry.asdict(...)
function:
@strawberry.typeclass User: name: str age: int
# should be {"name": "Lorem", "age": 25}user_dict = strawberry.asdict(User(name="Lorem", age=25))