devtools.codes

Structured Output Validator

RUNS LOCALLY

Paste a JSON Schema and a model response, and see exactly which constraint each value broke. The validator unwraps fenced code blocks and prose automatically, reports every violation at once rather than stopping at the first, and names the property path so you can find it in a long document.

Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information.

How to use it

  1. Paste your JSON Schema into the left pane. Drafts 2020-12, 07 and 04 are all accepted.
  2. Paste the model response into the right pane exactly as it arrived, including any surrounding prose or code fences.
  3. Press Validate. The extraction step reports what it pulled out before validating it.
  4. Work through the problems list. Each one names the path, the constraint and the value that broke it.

A worked example

The example loads a sentiment-analysis schema alongside a response that a model genuinely might return: a sentence of preamble, a fenced JSON block, a score returned as the string "0.87" rather than a number, and an invented "confidence" property that the schema never declared.

Validation reports two problems. The type error shows that a model asked for a number will often return a numeric string, which is why a schema alone does not guarantee a usable value. The additional-property error shows why additionalProperties: false matters — without it, invented fields pass silently into your pipeline.

Press Example in the workspace above to load it.

Questions

Why does my response fail validation when it looks correct?

The three usual causes are a number returned as a string, a property the model invented, and a missing field the schema marked required. All three look fine to a human reading the JSON. The validator reports the property path for each, so you can see which value is at fault rather than re-reading the whole document.

Does it handle responses wrapped in markdown code fences?

Yes. Models frequently wrap JSON in a fenced block with a sentence either side. The tool extracts the first complete JSON value, and tells you what it did and how many other candidate blocks it ignored. Extraction is always reported rather than performed invisibly, so you can see whether it picked the block you meant.

Which JSON Schema drafts are supported?

Draft 2020-12 is the default and the one most provider tool-definition formats expect. Drafts 07 and 04 are also accepted. If your schema declares a $schema keyword it is respected; otherwise 2020-12 is assumed. A schema that will not compile is reported separately from a response that fails validation.

Why does it report every error rather than stopping at the first?

Because fixing one error at a time and re-running is slow, and the errors are usually related. A model that invented one property has often invented several. Seeing the whole list at once tells you whether the problem is a prompt issue or a single bad value.

Does my input leave the browser?

No. Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information. Nothing you paste is logged, stored or sent to an analytics event, and there is no account to attach it to.