LLM JSON Schemas

What are the most common errors when using JSON schemas with OpenAI or Anthropic APIs?

Common JSON schema errors with LLM APIs include overly complex nested structures that models struggle to generate reliably. Circular references or deeply recursive definitions cause generation failures. Conflicting constraints like mutually exclusive required fields break generation. Using unsupported schema features: OpenAI supports subset of JSON Schema Draft 2020-12, Anthropic has similar limitations. String patterns that are too restrictive may cause consistent failures. Enum values with too many options reduce reliability. Missing schema validation before API submission wastes tokens on invalid schemas. Not providing examples in prompts to guide schema compliance. Forgetting that schemas apply only to structured output modes, not regular completions. Type mismatches between schema and prompt expectations. Overly strict number ranges that prevent reasonable outputs. Validate your schemas with our JSON Editor at jsonconsole.com/json-editor before API usage. Start with simple schemas and increase complexity gradually. Test schemas thoroughly with various prompts to identify edge cases.
Last updated: December 23, 2025

Still have questions?

Can't find the answer you're looking for? Please reach out to our support team.