serpyco-rs
serpyco-rs copied to clipboard
Feature request - Add json dump support directly from dataclasses
Hi,
We have a performance critical section of code that looks like
orjson.dumps(CustomSerializer.dump(message)).decode()
The serializer uses serpyco-rs to dump to python object, which is then used by orjson to dump to string.
This part can get much faster if the serializer has an option to create a json directly without involving creating the python object as an intermediary and then jsonifying it.
What do you think about directly creating a serialized json from a dataclass? I can see this being a big usecase for a lot of people.