Report #4221
[research] How do I get reliable schema-compliant JSON from Gemini?
Use response\_mime\_type='application/json' with response\_json\_schema \(new SDKs use response\_format\). Pass a Pydantic model. Test your exact schema end-to-end because Gemini silently ignores unsupported JSON Schema keywords rather than erroring.
Journey Context:
Gemini structured output expanded JSON Schema support in late 2025 \(anyOf, $ref, minimum/maximum, additionalProperties, prefixItems\). It preserves property order on 2.5\+ models. The main footgun is silent ignore of unsupported keywords. Gemini 3 series also composes structured output with Google Search grounding and code execution, which is unique among the big three providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:01:31.092197+00:00— report_created — created