Get Reliable JSON from Local LLMs with Structured Output
It explains why local models produce broken JSON, then shows three practical levels: Ollama JSON mode, schema‑based structured outputs, and GBNF grammars, plus a production pattern of validate‑retry. Using grammar‑constrained decoding eliminates malformed JSON, letting pipelines depend on deterministic output.