---
title: "What is JSON mode? json_object vs json_schema explained"
description: "JSON mode makes an LLM reply parse as valid JSON but does not enforce any schema. How response_format json_object works and when to use structured outputs instead."
url: https://broadrouter.com/glossary/json-mode/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# JSON mode

Updated 2026-11-14

JSON mode is an LLM API setting, response\_format {"type": "json\_object"} in OpenAI-style APIs, that makes the model's reply valid, parseable JSON. Unlike structured outputs with a JSON Schema, it does not guarantee which keys, types or values the object contains.

Also called: json\_object, JSON output mode, JSON response mode

JSON mode answers one question: will `json.loads()` succeed? It does not answer the second: is this the object my code expects?

## How it works

In the Chat Completions API you turn it on with one field:

```json
{"response_format": {"type": "json_object"},
 "messages": [
   {"role": "system", "content": "Return JSON with keys name and email."},
   {"role": "user", "content": "Reach me at Sara, sara@example.com"}]}
```

OpenAI’s API reference calls this “the older JSON mode, which ensures the message the model generates is valid JSON.” Two rules come with it. You must ask for JSON in a message: OpenAI’s guide says the API “will throw an error if the string ‘JSON’ does not appear somewhere in the context.” And the shape is up to the model. The guide states that JSON mode “will not guarantee the output matches any specific schema.”

[Structured output](https://broadrouter.com/glossary/structured-output/) is the stricter option. It passes a JSON Schema with `{"type": "json_schema", ...}`, and the model is constrained to it.

|  | JSON mode (`json_object`) | Structured outputs (`json_schema`) |
| --- | --- | --- |
| Valid JSON | yes | yes |
| Required keys and types | no | yes |
| You supply a schema | no | yes |
| Must mention “JSON” in prompt | yes (OpenAI) | no |

OpenAI recommends “always using Structured Outputs instead of JSON mode when possible.”

## Why it matters

-   **Validation is still yours.** With JSON mode, a missing key or a number sent as a string parses fine and fails later. Validate against a schema in code.
-   **Truncation.** If the reply hits [`max_tokens`](https://broadrouter.com/glossary/max-tokens/), the JSON is incomplete. Reasoning models are more exposed, since thinking uses the same budget.
-   **Fallback.** OpenAI’s guide lists JSON mode on older models where `json_schema` is not available. Support varies by provider and model, so JSON mode plus your own validation is the fallback when a schema is not accepted.

## On BroadNet Inference

BroadNet’s [API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-json-mode&utm_content=body#models) lists structured output for GLM 5.3 and Qwen3.8 27B. It does not say whether `json_object` or `json_schema` is the supported `response_format`, or whether DeepSeek V4.1 Flash and BroadNet Gemma 4 VL 26B accept either. Test both on your model. To write the schema, use the [JSON Schema generator](https://broadrouter.com/tools/json-schema-generator/). The post [JSON mode vs json\_schema](https://broadrouter.com/blog/structured-output-json-schema/) covers repair and monitoring, and the [invoice guide](https://broadrouter.com/guides/read-arabic-invoices-with-vision/) shows JSON extraction from images.

## Questions

### Is JSON mode the same as structured outputs?

No. OpenAI's guide says both produce valid JSON, but only Structured Outputs ensure schema adherence. JSON mode can return any valid object.

### Why does JSON mode return an error about the word JSON?

OpenAI requires the instruction to produce JSON somewhere in the messages and errors if the string "JSON" does not appear in the context.

### Can JSON mode still return broken JSON?

Yes, if the reply is cut off by max\_tokens or the context limit. Check finish\_reason before parsing.

## See also

-   [Structured output](https://broadrouter.com/glossary/structured-output/) (term)
-   [Tool calling](https://broadrouter.com/glossary/tool-calling/) (term)
-   [max\_tokens](https://broadrouter.com/glossary/max-tokens/) (term)
-   [System prompt](https://broadrouter.com/glossary/system-prompt/) (term)
-   [OpenAI-compatible API](https://broadrouter.com/glossary/openai-compatible-api/) (term)
-   [JSON Schema](https://broadrouter.com/glossary/json-schema/) (term)
-   [Read Arabic invoices and receipts with a vision model](https://broadrouter.com/guides/read-arabic-invoices-with-vision/) (guide)
-   [Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/) (guide)
-   [JSON mode vs json\_schema: structured output that holds up](https://broadrouter.com/blog/structured-output-json-schema/) (article)
-   [Extract invoice, receipt and form data to JSON with a vision LLM](https://broadrouter.com/blog/extract-data-from-documents-with-vision-llm/) (article)
-   [How to fix invalid JSON from an LLM: causes, repair, retry](https://broadrouter.com/blog/fix-invalid-json-from-llm/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-json-mode&utm_content=page-cta) ·

**Sources**

-   [OpenAI, Structured Outputs guide (JSON mode vs Structured Outputs)](https://developers.openai.com/api/docs/guides/structured-outputs)
-   [OpenAI API reference, create chat completion (response\_format)](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
-   [BroadNet Inference API reference, model IDs](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-json-mode&utm_content=sources#models)
