Compare Prices
ProvidersModelsCompareCalculatorsGuides
Dev Utility · Strict Mode · Free

LLM JSON Schema, TypeScript & Zod Generator

Paste any sample JSON payload to generate strict LLM Structured Output JSON Schemas, TypeScript interfaces, and Zod validators instantly.

Presets:
Sample JSON Payload
Valid JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "InvoiceExtraction",
  "type": "object",
  "properties": {
    "invoiceNumber": {
      "type": "string"
    },
    "vendorName": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "issuedDate": {
      "type": "string"
    },
    "isPaid": {
      "type": "boolean"
    },
    "subtotal": {
      "type": "number"
    },
    "taxAmount": {
      "type": "number"
    },
    "totalAmount": {
      "type": "number"
    },
    "lineItems": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "unitPrice": {
            "type": "number"
          },
          "amount": {
            "type": "integer"
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPrice",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "notes": {
      "type": "null"
    }
  },
  "required": [
    "invoiceNumber",
    "vendorName",
    "currency",
    "issuedDate",
    "isPaid",
    "subtotal",
    "taxAmount",
    "totalAmount",
    "lineItems",
    "notes"
  ],
  "additionalProperties": false
}

How it works

  1. 1Paste a representative JSON response—or pick one of the three presets (Invoice Extraction, User Profile, API Error & Meta).
  2. 2The local parser validates syntax with line/column diagnostics and infers nested objects, arrays, integers, floats, booleans, and null fields.
  3. 3Switch between LLM JSON Schema, TypeScript, and Zod Schema tabs—or toggle the OpenAI response_format wrapper.
  4. 4Copy the active output into your OpenAI, Anthropic, or Vercel AI SDK codebase.

Frequently asked questions

Why does the generated JSON Schema set additionalProperties: false and list every key in required?

OpenAI's strict Structured Outputs (strict: true) and many Anthropic tool_use schemas require every object node to declare additionalProperties: false and include all properties in its required array.

Can I wrap the schema for OpenAI's response_format parameter?

Yes. Check 'OpenAI response_format' in the LLM JSON Schema tab to wrap your schema inside { type: 'json_schema', json_schema: { name, strict: true, schema } }.

How does it distinguish integer from number?

Values without fractional decimals (like 120 or 429) infer type: 'integer' in JSON Schema and z.number().int() in Zod, while decimals (like 420.5) infer type: 'number' and z.number().

What happens if an array contains objects with slightly different keys?

The generator merges keys across all object items in the array so optional or partially populated fields aren't dropped from the inferred schema.

Related tools

View all tools →