aiagentrank.io
Subscribe
🔌Toolingalso: json mode, strict json mode, json response format

JSON mode

An LLM API setting that constrains the output to syntactically valid JSON — and, with strict mode, to a specific schema. The simplest reliable path to structured output.

Before JSON mode, agent authors prompted "respond in JSON" and prayed. Every few requests the model would emit prose, fenced code, or malformed JSON. JSON mode (OpenAI 2023, Anthropic 2024) made the runtime guarantee valid JSON via constrained decoding.

Strict JSON mode goes further and enforces a JSON Schema. The model literally cannot produce a field that does not match the schema. This collapses an entire class of agent bugs — wrong field names, missing required fields, type mismatches.

JSON mode is the right default for tool arguments, structured extractions, and any place where downstream code needs to parse the result. The cost is a small latency increase and slightly less expressive prose.

Frequently asked

JSON mode vs. function calling — which should I use?+

Function calling when the structure is "which tool to call and with what args." JSON mode when you want structured data without invoking a tool. Most production agents use both.

Does JSON mode hurt quality?+

On strict JSON mode, slightly — the model has less room to "think out loud" before the structured answer. Mitigate with a thinking field or a reasoning model that thinks before constrained decoding.

Related terms