Submit a Story

Glossary term

JSON Mode

Updated Oct 17, 2026

In short

An API or model setting that encourages or constrains a response to be valid JSON, usually without enforcing every field in a specific schema.

JSON mode is useful when an application needs machine-readable output rather than a paragraph. It typically targets valid JSON syntax, but may not guarantee that required keys exist, values have the right types or fields obey business rules. Those checks may still belong in application code.

A quick prototype might ask for a JSON object listing the people and dates found in an email. JSON mode helps ensure the reply can be parsed, but the model may still omit a field or use a different name. Wrap the parse in error handling, retry once on failure with retry logic, and log the raw response so you can see what went wrong.

If downstream code depends on an exact shape, prefer schema-based structured output when the model provider supports it, then validate the result before acting on it. Related: Structured Output, Constrained Decoding.