---
title: "What is JSON Schema? Describing JSON for LLM output | BroadRouter"
description: "JSON Schema is a standard for describing the shape of JSON data. How LLM APIs use it for tool parameters and structured output, and which keywords they support."
url: https://broadrouter.com/glossary/json-schema/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# JSON Schema

Updated 2026-11-15

JSON Schema is a vocabulary, written in JSON, for describing and validating the structure of JSON data: types, required fields, allowed values and nesting. The current version is 2020-12. LLM APIs use it to define tool parameters and the exact shape a structured output must follow.

Also called: json\_schema, JSON Schema draft 2020-12

A prompt that says “reply in JSON” leaves the shape to chance. A JSON Schema writes the shape down so a machine can check it.

## How it works

The specification has two main parts: Core, which “defines the basic foundation of JSON Schema”, and Validation, which “defines the validation keywords”. The current version is 2020-12; the one before was 2019-09.

```json
{
  "type": "object",
  "properties": {
    "name":    {"type": "string"},
    "amount":  {"type": "number", "minimum": 0},
    "currency": {"type": "string", "enum": ["SAR", "AED", "USD"]},
    "note":    {"type": ["string", "null"]}
  },
  "required": ["name", "amount", "currency", "note"],
  "additionalProperties": false
}
```

LLM APIs use schemas in two places. Tool definitions put one in `parameters` to describe the arguments. [Structured output](https://broadrouter.com/glossary/structured-output/) sends one in `response_format` as `{"type": "json_schema", "json_schema": {...}}`, which OpenAI says “ensures the model will match your supplied JSON schema”.

OpenAI’s strict mode accepts only a subset. From its supported-schemas section:

-   Types: string, number, boolean, integer, object, array, enum and anyOf.
-   The root must be an object and cannot use `anyOf`.
-   `additionalProperties: false` and every field listed in `required`; make a field optional by allowing `null`, as `note` does above.
-   Up to 5000 object properties and 10 levels of nesting, and up to 1000 enum values in total.
-   Not supported: `allOf`, `not`, `dependentRequired`, `dependentSchemas`, `if`, `then`, `else`.

## Why it matters

-   **Validation.** The same schema that guides the model checks its reply in your code. A failed check gives an exact error to send back.
-   **Portability.** A schema written to the strict subset works across more providers than one using every keyword.
-   **Tokens.** Schemas in tool definitions are sent as input on every request. Long descriptions cost tokens each turn.

## On BroadNet Inference

BroadNet’s [API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-json-schema&utm_content=body) documents tool calling and structured output for [GLM 5.3](https://broadrouter.com/models/glm-5.3/) and [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/), but not which schema keywords are enforced. Keep schemas to the simple subset above and validate every reply. Build a schema with the [JSON Schema generator](https://broadrouter.com/tools/json-schema-generator/), check replies with the [LLM JSON output validator](https://broadrouter.com/tools/llm-json-output-validator/), and see the [structured output post](https://broadrouter.com/blog/structured-output-json-schema/) for a full example. On other models, ask for JSON in the prompt and validate the reply; [JSON mode](https://broadrouter.com/glossary/json-mode/) is not documented by BroadNet, so test before relying on it.

## Common mistakes

-   Using `allOf` or conditional keywords and assuming the server enforces them.
-   Making fields optional by leaving them out of `required` in strict mode, instead of allowing `null`.

## Questions

### Do LLM APIs support all of JSON Schema?

No. OpenAI supports a subset: for example, the root must be an object, every field must be required, additionalProperties must be false, and keywords such as allOf, not and if/then/else are not supported.

### What is the difference between JSON Schema and JSON mode?

JSON mode only promises valid JSON. A JSON Schema tells the model, and your validator, which fields and types that JSON must have.

### Can I use JSON Schema with BroadNet Inference?

Tool parameters and structured output, which both use schemas, are documented for GLM 5.3 and Qwen3.8 27B. BroadNet does not document which schema keywords it enforces, so validate every reply.

## See also

-   [Structured output](https://broadrouter.com/glossary/structured-output/) (term)
-   [JSON mode](https://broadrouter.com/glossary/json-mode/) (term)
-   [Tool calling](https://broadrouter.com/glossary/tool-calling/) (term)
-   [tool\_choice](https://broadrouter.com/glossary/tool-choice/) (term)
-   [MCP (Model Context Protocol)](https://broadrouter.com/glossary/mcp/) (term)
-   [Named entity recognition (NER)](https://broadrouter.com/glossary/named-entity-recognition/) (term)
-   [JSON mode vs json\_schema: structured output that holds up](https://broadrouter.com/blog/structured-output-json-schema/) (article)
-   [How to fix invalid JSON from an LLM: causes, repair, retry](https://broadrouter.com/blog/fix-invalid-json-from-llm/) (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)

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-schema&utm_content=page-cta) ·

**Sources**

-   [JSON Schema specification, version 2020-12 (Core and Validation) (checked 2026-11-15)](https://json-schema.org/specification)
-   [OpenAI, structured outputs guide (supported schemas) (checked 2026-11-15)](https://developers.openai.com/api/docs/guides/structured-outputs)
-   [OpenAI API reference, create chat completion (response\_format json\_schema) (checked 2026-11-15)](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
