Skip to content

LLM Structured Output Validator

Validate LLM JSON output against a JSON Schema, with OpenAI, Anthropic and MCP presets, per-field fixes and sample output. Also has a REST API.

LLM Structured Output Validator

Presets:
JSON Schema (draft-07)
JSON output to validate

Validation failed, 2 errors

Invalid— 2 errors found
Errors
$.createdrequired
Expected: property must exist
Actual: missing

Add required property "created"

$.choices[0].finish_reasonenum
Expected: one of: ["stop","length","function_call","tool_calls","content_filter"]
Actual: "done"

Use one of the allowed values: stop, length, function_call, tool_calls, content_filter

Annotated output
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "example-model",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Your order ships on Monday."
      },
      "finish_reason": "done" <-- error
    }
  ]
}

Supported validations

typerequiredenumconstpatternformatminLength / maxLengthminimum / maximumexclusiveMinimum / exclusiveMaximumminItems / maxItemsuniqueItemsminProperties / maxPropertiesadditionalPropertiesitems (array)allOf / anyOf / oneOfnot$ref (local)nested objectsinteger

Updated . Provided as is. Check the output before you rely on it in production.

How to use LLM Structured Output Validator

  1. 1

    Define the JSON Schema

    Paste your JSON Schema (draft-07) or start from a preset such as an OpenAI function response, Anthropic tool result or MCP tool output.

  2. 2

    Paste the model's output

    Paste the JSON the model returned into the validation panel.

  3. 3

    Validate

    Validate to check the output against the schema: type mismatches, missing required fields, enum violations and more.

  4. 4

    Read the errors

    Each error shows the field path, the expected value and the actual value, and the annotated output marks where it failed.

  5. 5

    Fix and re-validate

    Adjust your prompt or schema and validate again. Generate Sample creates a valid example from the schema for reference.

Questions and answers

What is structured output from an LLM?
Structured output is model-generated JSON that must match a predefined JSON Schema, as used for function calling, tool results and data extraction. This tool checks a JSON response against your schema, marks each failing field with the expected value and a suggested fix, and can generate a valid sample.
What JSON Schema versions are supported?
It validates a subset of JSON Schema 2020-12: type, enum, const, string length, pattern, format, numeric bounds, required, properties, additionalProperties, array items and uniqueItems, allOf, anyOf, oneOf, not and local $ref. Other keywords are reported as not checked.
How do I fix 'missing required field' errors?
The error shows which field is missing and its expected type. Either adjust your prompt to ensure the LLM includes the field, or update your schema to make the field optional by removing it from the required array.
Can I generate sample valid output from a schema?
Yes, click 'Generate Sample' to create a valid JSON object filled with placeholder values matching your schema. This is useful for testing and as a reference for expected output structure.
Does this replace JSON Formatter?
No. JSON Formatter validates JSON syntax (is this valid JSON?). This tool validates JSON structure against a schema (does this JSON match the expected shape?). They complement each other.
For AI agents: how to call this tool

Machine-readable contract, endpoints and examples. Humans can ignore this section.

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/structured-output-validator/

For automation planning, fetch the canonical contract at /api/tool/structured-output-validator.json.