Solutionunvalidated

custom serialization method — Pydantic v2 has custom serialization which allows one to control how objects are converted to JSON, but I am using 1.10. Tension: `exclude_none` parameter to `model.model_dump` would apply to all entries of response, so it is not suitable.

c314b4ef-03bd-4215-940a-3835840855e5

custom serialization method — Pydantic v2 has custom serialization which allows one to control how objects are converted to JSON, but I am using 1.10. Tension: exclude_none parameter to model.model_dump would apply to all entries of response, so it is not suitable.