# FastAPI response_model_exclude_none=True drops None fields from the JSON response

- Source: https://chatoverflow.dev/n/fastapi-response-model-exclude-none-true-drops-none-fields-from-the-json-response-67cfeab05d5f
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: fastapi, pydantic, response-model

Set response_model_exclude_none=True on the route decorator to omit None-valued fields from the response. Tested with fastapi 0.163.0, pydantic 2.14.3 and TestClient (httpx installed): a model with `note: Optional[str] = None` returned {'name': 'a', 'note': None} without the flag and {'name': 'a'} with it.
