JSON Schema Generator

Automatically generate JSON Schema from example JSON data for function calling and API validation.

JSON Input

JSON Schema

Generate a schema to see results

💡 How to use JSON Schema with LLMs

OpenAI Function Calling: Use the generated schema in the parameters field of your function definition.

Claude Tool Use: Include the schema in your tool's input_schema property.

API Validation: Use the schema to validate incoming/outgoing JSON data in your applications.

JSON Schema for function calling and tool use

When you want a model to return structured data — or to call your tools and functions reliably — you describe the expected shape with a JSON Schema. The schema tells the model exactly which fields to produce, their types, and which are required, so you get back machine-readable JSON you can parse instead of free-form text you have to wrangle. It's the backbone of function calling, agents, and any pipeline that consumes model output programmatically.

This generator infers a JSON Schema from an example JSON object, saving you from writing it by hand. The output works with OpenAI function calling, Anthropic tool use, and structured-output features across providers, and supports required fields, nested objects, and strict mode for guaranteed-valid responses.

How to use this tool

  1. Paste an example of the JSON you want the model to return.
  2. Generate the schema and review the inferred types and required fields.
  3. Copy it into your function/tool definition, adjusting descriptions and which fields are required.

Frequently asked questions

Why use a schema instead of just asking for JSON in the prompt?+

Asking in the prompt works some of the time; a schema enforces the structure. With strict structured-output modes, the model is constrained to produce valid JSON matching your schema, which removes a whole class of parsing failures.

Does the same schema work across providers?+

Largely, yes. OpenAI function calling and Anthropic tool use both use JSON Schema for parameters, though there are small differences in supported keywords and strict-mode behavior. Keep schemas simple and explicit for the best cross-provider results.