The Open-Source AI Stack

Glossary

JSON mode

A weaker predecessor to structured output: the model is constrained to emit syntactically valid JSON, but not necessarily JSON that conforms to a specific schema.

The earlier, weaker promise that sits one step below structured outputruntimeMaking a model emit text that conforms to a schema or type (often JSON matching a JSON Schema) rather than free-form prose, so downstream code can parse it reliably. Open full entry . JSON mode constrains a model to produce text that parses as valid JSON: balanced braces, quoted keys, no trailing commas. What it does not promise is that the JSON matches the schema you wanted. The keys can be wrong, a required field can be missing, a number can arrive as a string.

The distinction matters in practice. With JSON mode a parser will not throw on malformed syntax, but downstream code still has to validate that the object has the shape it expects and handle the cases where it does not. Schema-conforming structured output, by contrast, is checked during constrained decodingruntimeMasking the model's next-token probabilities at each step so only tokens allowed by a grammar or schema can be sampled, forcing the output to be structurally valid. Open full entry against the schema itself, so a conforming object is the only thing that can come back.

JSON mode is still useful when the exact shape is loose or the caller will validate anyway, and it is cheaper to support than full grammar compilation. It is worth naming because model and engine docs often expose both, and the difference between “valid JSON” and “JSON that matches my schema” is the difference between code that mostly works and code that always parses.

Sources

Mentioned in

Back to glossary