AI State of the Art
Mistral/API Capabilities in Detail/12 min
Section 266

JSON Mode & Structured Output: json_object vs json_schema

Listen as a podcast →
Status as of July 2026

Both mechanisms still exist and have not been renamed: JSON Mode (response_format set to {"type": "json_object"}) and Custom Structured Outputs ({"type": "json_schema"}). The documentation explicitly recommends the second whenever you know the shape you expect. What moved is the model list: the "Structured Outputs" capability appears on the cards for Mistral Medium 3.5, Mistral Small 4, Mistral Large 3 and Ministral 3. The docs were also reorganised, these pages now live under docs.mistral.ai/capabilities/structured_output/.

The Problem: A Model That Answers in Prose Where Your Code Expects Data

You ask Mistral to extract information from an email. It replies with three paragraphs of explanation, then some JSON with a missing comma. Your code crashes. And it happens 500 times a day in production.

This is the classic situation: by default an LLM generates free-form text. That is its job. But the moment that LLM becomes a cog in an automated chain, free text turns into a nightmare, broken JSON, structure that changes from call to call, chatter wrapped around the payload ("Here are the extracted data:"), expected fields simply missing.

The General Mechanism Is Covered Elsewhere

The principle that makes all of this possible (constrained decoding, where at each step you filter which words the model is allowed to produce using a formal grammar) is covered in detail on the Structured output page in the fundamentals. This page does not re-explain the machinery: it focuses on what is specific to the Mistral API, namely the two modes, their exact names, and what each one really guarantees.

Mode 1: json_object, the Minimal Contract

The simplest mode. One field in the request:

{
  "response_format": { "type": "json_object" }
}

What the documentation says: this mode ensures the model's response is a valid JSON object, regardless of the content of the prompt.

But it immediately adds a recommendation that tells you a lot: you are still advised to explicitly ask the model in your prompt to return a JSON object, and to describe the format you want. In other words, json_object locks the syntax, not the content. Field names, their number and their types remain your responsibility, and they depend entirely on how good your prompt is.

What is locked: you will get a syntactically valid JSON object.

What is not: the exact schema. You ask for name and age; the model may add a field, drop one, or return "30" (a string) where you expected 30 (an integer). The structure can drift between calls.

Think of it as a minimal contract: "it will be valid JSON," with no promise about what is inside.

With json_object, Your Prompt Is Your Informal Schema

Since nothing beyond syntax is enforced, output quality depends entirely on your instructions. Put a concrete example in the prompt, be explicit about expected types (number, string, boolean), about which fields are mandatory, and about date formats. Then validate the output in your code as though there were no structural guarantee at all, because there isn't one.

Mode 2: json_schema, the Blueprint to Follow

This is what Mistral calls Custom Structured Outputs, and what it recommends whenever you know the shape you expect. You supply a schema, and the model is bound to it:

{
  "response_format": { "type": "json_schema" }
}

The schema itself is supplied in whatever way suits your language. The documentation shows the shortest path, where you describe the expected shape as a class and let the SDK handle the rest:

chat_response = client.chat.parse(
    model="ministral-8b-latest",
    response_format=Book,
    messages=[...],
    temperature=0
)

Here Book is a Pydantic model (on the Python side; it is a Zod schema in JavaScript, or a raw JSON Schema if you prefer working without an SDK). The SDK returns both the raw JSON, in chat_response.choices[0].message.content, and the object already validated against your schema.

What the documentation guarantees: the generated message is JSON and follows the schema you provide. Concretely, required fields are present, types are respected, enum constraints hold, and nested objects sit where they belong.

It is the difference between saying "make me a cake" (json_object) and handing over the recipe with the proportions (json_schema).

One Detail That Explains a Lot of Behaviour

The documentation notes that when you use this method, a sentence is always prepended to the system prompt: "Your output should be an instance of a JSON object following this schema", followed by the schema. Your schema is therefore not only a technical constraint applied to generation, it is also an instruction the model reads. Hence the documentation's advice: write good field descriptions and add explanations to your system prompt, because the model genuinely uses them.

Which Models Support What

The Structured Outputs capability appears on the cards of the current general-purpose models:

ModelVersionStructured outputs
Mistral Medium 3.5v26.04Yes
Mistral Small 4v26.03Yes
Mistral Large 3v25.12Yes
Ministral 3 (14B, 8B, 3B)v25.12Yes

A practical note: this is not reserved for large models. The official structured-output example runs on a Ministral 8B. For pulling fields out of a document, a small model constrained by a schema often matches a large model left free, at a fraction of the cost.

The Golden Rules

Use json_schema whenever you can. If you know the expected structure (which is almost always true in production) it is the default choice. The documentation says as much: this mode is more reliable, and json_object is there for when you need flexibility while keeping a JSON structure.

Keep schemas simple. A schema ten levels deep with complex union types is harder for the model to satisfy and harder for you to debug. Two or three levels are nearly always enough; if they are not, split the work across several calls.

Describe your fields. In your schema, the description property helps the model understand what belongs in each field, all the more so because, as above, the schema is actually shown to it. A cat field with "main product category" attached beats a bare cat every time.

Handle optionals in your code. If a field is optional, set a default on the client side. Do not rely on the model to guess what "optional" means in your business logic.

The Format Is Guaranteed, the Content Is Not

This is the limit to remember, and it matters for anyone feeding these outputs into a decision process. Structured mode guarantees the output is syntactically valid and schema-conformant. It guarantees nothing about whether the data is true. The model can hand you perfect JSON with an age of 9999, an invented amount, or a contract number that does not exist. A well-formed output looks trustworthy, which makes it more dangerous than an obviously broken one. Format validation never replaces content validation.

Concrete Use Cases

Information extraction. A thousand emails, and for each: sender, date, amount if it is an invoice, category. With a schema, the format is identical across all thousand. Zero parsing errors, zero manual intervention.

Classification. A free-form description in, and out comes a category drawn from a closed list (enum), a subcategory and a confidence level. The enum is what stops the model inventing a category that does not exist in your taxonomy.

Format conversion. Email to support ticket, scanned form to database record. The output is directly consumable by the next system.

ETL (Extract-Transform-Load) pipelines. Raw data in, a transformation by the model, a load into a database. Without a guaranteed format, one malformed response stalls the chain.

Quick Comparison

Free textjson_objectjson_schema
Valid JSONNoYesYes
Predictable structureNoNoYes
Guaranteed typesNoNoYes
Required fields presentNoNoYes
Values drawn from an enumNoNoYes
Content accurate and truthfulNoNoNo

In short: in production, use json_schema. It removes a whole class of failures, parsing errors, missing fields, pipelines breaking at three in the morning. It does not remove the last row of that table, and that is the one that still needs a human reader.