Commit Graph

1 Commits

Author SHA1 Message Date
Eugene Toder 3e3a4023bc Add PydanticJSONResponse
When using this response class, json serialization is done using
Pydantic's built-in json serialization (`dump_json(r)`) instead of
generating an intermediate dict that is later serialized using a json
library (`json.dumps(dump_python(r))`).

In my testing this is 3-4x faster than using the standard json library
(the default) and 50% faster than using orjson, without requiring any
extra dependencies. This also allows configuring serialization behavior
per model using Pydantic's model_config.
2025-12-14 12:29:30 -05:00