API Response Schema Inferrer

Infer a JSON Schema draft-07 from a sample LLM API response or any JSON object.

Ad placeholder (leaderboard)

API response schema inferrer

When you call an LLM API and get back structured JSON, you often want a schema: to enforce that shape with structured outputs, to validate responses before parsing, or just to document what your code expects. Writing one by hand is tedious. This tool reads a real sample and produces a JSON Schema draft-07 describing it, instantly and entirely in your browser.

How it works

The tool parses your JSON and recursively walks the value tree. Strings, numbers, booleans, and null map to their JSON Schema types; objects become type: object with a properties map and a required list of their keys; and arrays become type: array with an items schema inferred from the first element. The result is a self-contained schema document you can copy and drop into a validator or an LLM structured-output config.

Tips and notes

  • Inferred required is a starting point. Every key in the sample lands in required. Delete the ones that are genuinely optional before validating real traffic.
  • Mixed arrays need a manual merge. Item schemas come from the first array element only. If your arrays vary, combine the variants by hand.
  • Add constraints after inference. The tool gives you types and structure; add enums, formats, minimums, and patterns yourself to make the schema strict.
  • Great for function calling. The inferred object schema drops cleanly into a tool or function parameter definition for OpenAI or Anthropic.
Ad placeholder (rectangle)