IT lexicon › AI & ML › JSON mode

JSON mode

AI & ML På svenska → Updated: 2026-05-27

LLM feature that guarantees the output is valid JSON. OpenAI launched it in 2023; Anthropic + Google followed. Implemented via constrained decoding — token sampling is forced to follow a grammar so only JSON-conforming tokens can be chosen.

Further: structured output with a JSON Schema. The model is given the schema, output is guaranteed to match. OpenAI Strict Mode (2024) — 100% schema conformance. Classic problem before: ask for JSON → the model sometimes prefixes "Here is JSON:" which breaks the parser. Open source: outlines, LMQL, instructor, llama.cpp grammar mode. Use cases: function calling, data extraction, app integrations. Trade-off: slightly constrained creativity in output (the schema is a hard fence).

← Back to the lexicon