LLM Structured Output Validator (JSON Schema)

Even with OpenAI's Structured Outputs, Anthropic's tool use, or Gemini's controlled generation, LLM JSON responses occasionally drift — extra fields, wrong enum values, malformed dates. This validator takes a JSON Schema and an LLM response, runs them through a Draft 2020-12 validator, and tells you exactly which fields fail and why. Useful for diagnosing why a parse failed in production, or for iterating on the schema in development.

How to use the LLM Structured Output Validator (JSON Schema)

Paste your JSON Schema on the left and the LLM response on the right. Click "Validate" or wait — validation runs live as you type. Errors are listed by JSON pointer path (e.g. /users/2/email) with the specific keyword that failed (required, type, enum, format, etc.).

The examples cover three common LLM patterns: structured person extraction, function/tool calling format, and unstructured text → typed entity extraction.

About LLM Structured Output Validator (JSON Schema)

OpenAI introduced Structured Outputs in August 2024 — pass a JSON Schema with strict: true and the model is guaranteed (via constrained decoding at the token level) to produce output matching the schema. Anthropic's Claude supports a similar concept via tool use input schemas, and Google's Gemini has "controlled generation". These work very well for the schemas they support — but each has limitations:

  • OpenAI: must use a subset of JSON Schema (no oneOf in some cases, no patternProperties, limited recursion).
  • Anthropic: trains-on the schema but doesn't hard-constrain, so violations are rare but possible.
  • Gemini: similar story — best-effort, not bit-perfect.

So validation matters. A 0.1% failure rate is still a lot of broken production requests if you're running 100K calls a day. Most production LLM stacks include a JSON Schema validation step after the model call — fail closed if validation fails, retry once with the error in the prompt, fall back to a default response if retry also fails.

This tool runs Ajv (a Draft 2020-12 JSON Schema validator, 35KB minified, the de-facto standard) entirely in your browser. The validation is exactly what your Node / Python (via jsonschema) / Java (networknt/json-schema-validator) backend would do — useful for replicating server-side errors locally.

Common use cases

  • Debugging structured-output failures — paste the schema and the response from your production logs, see why it didn't parse.
  • Iterating on prompt + schema — tweak the schema, paste a recent LLM output, confirm it still validates.
  • Cross-checking schema constraints — quickly verify "does this schema actually enforce that emails are valid?".
  • Migration — moving from one provider to another, validating that the new model's output still passes the old schema.
  • Schema design — building a schema for the first time and want fast feedback on what your prototype data looks like.

Frequently asked questions

What schema draft is supported?

Draft 2020-12 (the latest, the one OpenAI uses). Draft-07 schemas usually validate too — most differences are additive.

Does this hit any LLM API?

No. Pure browser-side validation. Paste your schema and response; nothing is sent anywhere.

Will it match exactly what Node / Python validation does?

Yes — Ajv is the reference implementation for JS. The Python jsonschema and Java validators match on the standard keywords. Format keywords (date-time, email, uri) can vary in strictness.

Can I validate streaming partial JSON?

Not with this tool — it expects complete JSON. For streaming validation, use a partial-JSON-tolerant parser like partialjson or build incrementally.