Valid JSON can still be the wrong object
Provider APIs first offered JSON-focused generation to prevent prose around a machine-readable response. Schema-constrained structured outputs tightened the contract by limiting generation to shapes allowed by a developer-supplied schema.
JSON mode can return {"temperature":"warm"} when the application expects a numeric Celsius field. The text parses, but it violates the application contract.
A schema can require temperature_c as a number and reject undeclared fields.
| Requirement | JSON mode | Structured outputs |
|---|---|---|
| Valid JSON syntax | Yes | Yes |
| Required fields and types | Application must validate them | Generation is constrained to the supported schema |
| Enum and nesting contract | Not guaranteed by JSON syntax | Constrained when the provider supports those schema features |
| Factual correctness | Not guaranteed | Not guaranteed |
Function calling adds an operation to the schema
Tool calling uses structured arguments to request a named operation. A structured response may simply be returned to the application without invoking anything.
Validation after generation is another option, but it may require repair or retry when the model produces an invalid shape.
Schema compliance is not semantic correctness
A response can match every type and still contain the wrong customer identifier or an unsupported conclusion. The host must validate permissions, ranges, referential integrity, and business rules that JSON Schema does not prove.
The structured outputs guide compares the API patterns in depth. JSON mode is enough when any valid JSON value is acceptable, while structured outputs fit stable contracts.
The common misuse is presenting schema compliance as proof that the underlying facts are correct.
Refusals and incomplete generations need a separate path
An API may return a refusal or stop before completing a schema-constrained object. Application code should inspect the provider’s finish state and refusal representation before attempting to parse ordinary output.
Schema versions also need coordination with consumers. Tightening an enum or making a field required can break a downstream client even when the model follows the new contract perfectly.
Continue with these glossary entries: