December 19, 2024pythonfastapipydanticFastAPI 返回值中排除 None 值在 FastAPI 中使用 Pydantic 的 exclude_none 选项,可以避免在 JSON 序列化时包含 None 值。