The text makes sense. Even so, the application cannot take it over, because the quantity appears once as “six”, once as 6 and once as a sentence in the comment. Structured outputs give this hand-over a contract. The more interesting part begins where correct JSON can be wrong in substance.
Mistral’s Custom Structured Outputs use a predefined JSON schema for this. Fields and data types are described explicitly. This organises the interface between model and application; it does not replace checking whether a value is actually supported by the source text.
Unknown is a state of its own
Our fictional note mentions folders but no quantity. The output should preserve this missing value. If you insert a default quantity instead, the data record looks more complete and loses an important piece of information in the process.
A small, vendor-neutral schema can look like this. Which schema keywords a particular interface supports must be checked against its current documentation before use:
{
"type": "object",
"required": ["artikel", "menge", "klaerung"],
"additionalProperties": false,
"properties": {
"artikel": {"type": "string"},
"menge": {"type": ["integer", "null"], "minimum": 0},
"klaerung": {"type": "string"}
}
}
required demands that the field is present. null nevertheless allows an explicitly unknown value. The lower bound applies to numerical quantities. Whether a quantity is permissible for the actual ordering process may require further business rules. Above all, the schema answers which form the downstream application can expect.
A preview without a model and without an order
You can already examine the processing with fixed sample data. Save the following HTML snippet, written by us, as a local sample file and open it in the browser. It displays a data record but makes no API request and saves no order.
<!doctype html>
<meta charset="utf-8">
<p id="ausgabe"></p>
<script>
const daten = { artikel: "Folders", menge: null, klaerung: "Quantity missing" };
function pruefe(d) {
if (!d || typeof d !== "object" || Array.isArray(d)) throw Error("Object expected");
const keys = Object.keys(d).sort().join(",");
if (keys !== "artikel,klaerung,menge") throw Error("Check fields");
if (typeof d.artikel !== "string" || typeof d.klaerung !== "string")
throw Error("Text expected");
if (d.menge !== null && (!Number.isInteger(d.menge) || d.menge < 0))
throw Error("Check quantity");
}
pruefe(daten);
const menge = daten.menge === null ? "not yet known" : String(daten.menge);
document.querySelector("#ausgabe").textContent =
daten.artikel + ": " + menge + ". " + daten.klaerung;
</script>
The function is a limited validator of our own for exactly this teaching schema, not a complete JSON Schema library. Change the quantity in turn to 6, to -1 and to the string “six”. Then add an unexpected field. Each time, observe the display or the error message in the developer tools.
This lets you test a transition before a model is involved. You know how the application handles known, unknown and invalid values. A later model answer can only reach this snippet after passing the same rules.
Checking format and meaning independently
A formally permitted 6 can still be wrong if the note says four. In a real application, therefore, add a reference to the source where needed and check important values against the input. With contradictory notes, the process should produce a point for clarification rather than picking an arbitrary number.
The output uses textContent. External text is thus inserted as text instead of being interpreted as HTML without any checks. Provider keys do not belong in a browser snippet like this. A model call would be a separate processing step with its own access and its own error handling.
Demonstrating the snippet on a website
If you want to show exactly this small display on an existing website, the developer mode of KENJTEC WebSiteBuilder ai is also one possible place for your own HTML/JavaScript code. The checked snippet is transferred by hand; code preview and your own code versions support the subsequent review. This does not create a native connection to Mistral.
The actual insight remains independent of where it is used: model format, your own validator, safe display and the decision on substance have different jobs. Anyone who keeps them apart can take over an AI output in a targeted way without quietly turning a plausible answer into an action.
Sources and status
Sources as of 25 October 2026. Custom Structured Outputs.

