LLM JSON Schema Validator
Validate JSON Schemas for OpenAI strict mode, function calling, Anthropic tool use, and Gemini controlled generation. Catch vendor-specific schema errors before shipping.
- $.properties.title Property "title" has no description. Claude relies heavily on descriptions to populate tool input correctly.
- $.properties.tags Property "tags" has no description. Claude relies heavily on descriptions to populate tool input correctly.
- $.properties.priority Property "priority" has no description. Claude relies heavily on descriptions to populate tool input correctly.
Vendor rules are hand-coded from each provider's structured-output documentation as of May 2026. Vendors loosen and tighten their schema subsets over time — when in doubt, check the linked docs.
How to use the llm json schema validator
Paste your JSON Schema on the left and a sample JSON response on the right. The validator checks the sample against the schema with ajv, and separately reports which LLM providers (OpenAI strict mode, OpenAI function calling, Anthropic tool use, Google Gemini controlled generation) will accept the schema, along with vendor-specific gotchas. Each vendor enforces a different subset of JSON Schema.
Formula & explanation
Validation uses ajv (JSON Schema draft 2020-12). Vendor compatibility uses hand-curated rules derived from each vendor's structured-output documentation — see lib/llm-schema-rules.ts in the source for citations.
Examples
An OpenAI strict-mode schema must have additionalProperties: false on every object and list every property in "required". Anthropic accepts a much broader subset. Gemini doesn't support oneOf/anyOf/allOf or $ref at all.
Frequently asked questions
- Why doesn't my schema work with OpenAI strict mode?
- OpenAI's strict mode (response_format: { type: "json_schema", strict: true }) requires every object to have additionalProperties: false, every property listed in "required", and forbids oneOf, allOf, and most validation keywords like minLength or pattern. Paste your schema in this tool and the OpenAI Strict column will list every constraint violation with a fix suggestion.
- What's the difference between OpenAI strict and function calling?
- Strict mode (a.k.a. Structured Outputs) guarantees the model emits JSON matching your schema; in exchange it imposes hard subset restrictions. Function calling (non-strict) is steered by the schema but the model can deviate — most JSON Schema keywords work as hints, but accuracy degrades on deeply nested or large schemas.
- Does Anthropic enforce additionalProperties: false?
- No. Anthropic's tool-use schema is the most permissive of the major vendors. It accepts standard JSON Schema including additionalProperties either way, oneOf/anyOf/allOf, and most validation keywords. The main practical limit is property count: keeping tools under ~20 top-level properties improves accuracy.
- Why doesn't Gemini support oneOf or $ref?
- Google Gemini's controlled generation uses a subset based on OpenAPI 3.0 schema, which historically didn't support these keywords. You need to inline any $ref'd subschemas and restructure unions as enums or a single type. The tool flags both as errors when you paste a schema with them.
- Can I get an exact token count for my schema?
- Not in this tool — pop over to the Token Counter for that. Schemas themselves count against your context window; deeply nested schemas can use a surprising number of tokens, especially in OpenAI function calling where the schema is sent on every turn.
- Does this validate offline?
- Yes. ajv runs entirely in your browser, and the vendor rules are hand-coded JavaScript. Nothing is sent to OpenAI, Anthropic, or Google — we just check your schema against the documented constraints.
Related developer tools tools
- JSON to TypeScriptGenerate TypeScript interfaces and types from any sample JSON. Handles nested objects, arrays, optional fields, and mixed types. Paste JSON, copy the interface.
- CSV to JSON ConverterConvert CSV to a JSON array of objects. Uses the first row as keys, handles quoted values, and detects common delimiters automatically.
- Token Counter for GPT, Claude, LlamaCount tokens for ChatGPT, GPT-4o, Claude, Llama, and Gemini before hitting context limits. Shows per-model token count, character count, and approximate API cost.
- String Escape/UnescapeEscape and unescape strings for JSON, JavaScript, HTML, and SQL. Handles special characters, backslashes, quotes, newlines, and Unicode escape sequences instantly.
- CSV to XML ConverterConvert CSV rows into XML elements with column headers as tag names. Useful for Excel exports, legacy systems, and ETL pipelines.
- CSV to YAML ConverterConvert CSV to YAML for use in config files, Ansible playbooks, and Kubernetes ConfigMaps. Uses the header row as YAML keys.
Related reading
- LLM Token Counting: GPT, Claude, Llama & Gemini ExplainedA practical guide to LLM tokens — how they work, why each model counts differently, real cost calculations at scale, and how to count tokens before sending a request.
- JSON Formatting Guide: Pretty-Print & Validate Like a ProEverything you need to know about JSON formatting — indentation rules, minification for production, common validation errors, and how to convert between JSON and other formats.