# JSON Mode

> A switch so the model only replies with JSON that will load.

**Field:** Artificial Intelligence  
**Category:** Working with AI  
**Also known as:** JSON Output Mode, JSON Response Format

## Think of it like

Think of it like a rule that all answers go in boxes. It does not say which boxes.

## Definition

JSON mode is a setting that makes a model reply only with valid JSON. The reply will parse, so a program will not crash on stray words. But JSON mode does not check the shape, so fields can be missing or named in other ways. Structured output with a schema is the stricter, newer option. JSON mode still helps where no schema is set or the API offers nothing else.

## Example

Jack turns on JSON mode and asks for three cities. He gets valid JSON each time, but once the key is 'cities' and the next time it is 'city_list'.

## Example code

```json
{"cities": ["Lisbon", "Oslo", "Kyoto"]}
```

Valid JSON every time, but nothing makes the key stay the same between calls.

## Why it matters

It stops one common failure, a reply a program cannot parse. It does not stop the rest.

## Common mistake

Using JSON mode and assuming the fields will match. Use a schema when the shape matters.

## Three principles

- **Always valid JSON.** It will parse.
- **No set shape.** Fields can change.
- **Schema is stricter.** Use it when it matters.

## Related terms

- [Structured Output (LLM)](https://learn.benibix.com/term/ai/structured-output)
- [JavaScript Object Notation (JSON)](https://learn.benibix.com/term/development/json)

## Told apart from

- [JSON Mode vs Structured Output](https://learn.benibix.com/compare/json-mode-vs-structured-output): People think JSON mode makes a model's reply fit their schema, and it does not. JSON mode only makes sure the reply is valid JSON, so a program can open it. The fields can still be missing or named in another way. Structured output checks the reply against the schema you give, so every field you asked for is there. Neither one checks that the values are true.

## Taught in

- [Structured Output and JSON](https://learn.benibix.com/learn/ai-working-with-ai/structured-output-and-json): Prompt Engineering, 10/16

![Three replies to the same request, each valid JSON. The list sits under a different key in each one: cities, city_list and names.](https://learn.benibix.com/diagrams/pr-json-mode.svg)

---

Source: https://learn.benibix.com/term/ai/json-mode
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
