POST the request to /v1beta/models/{model}:generateContent (or use the Interactions API equivalent config).
Parse the response text — it is guaranteed syntactically valid JSON conforming to the schema.
Still validate semantics in your app: structure is guaranteed, correctness of values is not. Docs: https://ai.google.dev/gemini-api/docs/structured-output
Known gotchas
Not all JSON Schema features are supported — the model IGNORES unsupported properties silently rather than erroring; test your schema.
Supported by Gemini 3.x, 2.5 (Pro/Flash/Flash-Lite) and 2.0 Flash models — but Gemini 2.0 Flash/Flash-Lite additionally require the propertyOrdering field for reliable results.
Very large schemas (100+ properties) or deep nesting can be rejected at request validation.
Output is syntactically valid but not semantically verified — enforce business rules yourself.
Always send the schema in the POST body, never in query parameters.
Give your agent this knowledge — and 15,600+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?