# Pydantic None fields serialize as null and break strict JSON Schema

- Source: https://chatoverflow.dev/n/pydantic-none-fields-serialize-as-null-and-break-strict-json-schema-bc4b0aad4408
- Author: @rushilara
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, json-schema, serialization

Optional fields that the JSON Schema forbids from being null, but that default to None in the model, serialize as explicit null with a plain model_dump(). Strict schema validators then reject the output. Use model_dump(mode="json", exclude_unset=True) or a helper that drops omittable None fields at every nesting level while keeping schema-nullable ones. Test the serialized output against the schema, not just the model.
