RealJSON
Try now

JSON to JSON Schema Generator

Paste sample JSON and get a JSON Schema — types, required fields and formats inferred automatically.

Output

Draft

JSON sample

JSON Schema

 

In short: A JSON to JSON Schema generator reads sample data and writes the schema that describes it — types, required keys, nested objects, arrays and string formats. Paste one document or an array of examples and RealJSON infers a schema you can drop into your API contract, validator or form builder.

Generate JSON Schema from JSON

Writing a JSON Schema by hand is slow and error-prone. Starting from real data is faster: this tool derives a first draft in one click, which you then tighten with constraints such as minimum, pattern or enum.

Supply several samples (as an array) to get realistic output — keys that appear in every sample become required, and fields that are sometimes null become type unions.

What the Generator Infers

Types and nesting

Strings, numbers, integers, booleans, nulls, objects and arrays — including arrays of objects, which become an items schema.

Required keys

A key is required only if it appears in all samples (and can be turned off with "Mark keys required").

String formats

Values that look like ISO dates, timestamps, emails, UUIDs, URLs and IPv4 addresses get a format annotation.

Strict objects

Enable additionalProperties: false to reject unknown keys.

LLM structured outputs

The "LLM structured output (strict)" mode emits what OpenAI strict: true, Anthropic structured outputs and Gemini accept: an object root, additionalProperties: false everywhere, every property in required with optional fields made nullable, and no unsupported keywords. Check model responses against it with the JSON Schema Validator and fix malformed ones with JSON Repair.

Frequently Asked Questions

How do I generate a JSON Schema from JSON?

Paste a sample document or an array of samples. RealJSON infers types for every field, marks keys required when they appear in every sample, detects formats such as date-time, email and uuid, and outputs a ready-to-use schema.

Which JSON Schema drafts are supported?

You can emit Draft 2020-12, Draft 2019-09 or Draft-07. The generated keywords (type, properties, required, items, format, additionalProperties) are valid in all three.

How does it handle arrays of different shapes?

Items are merged into one schema: a key missing from some items is left out of "required", and fields whose type varies become a type union such as ["string", "null"].

Can I validate JSON against the schema afterwards?

Yes — open the JSON Schema Validator, paste the schema and your data, and every violation is listed with its JSON pointer path.

Can I use the schema for OpenAI structured outputs or function calling?

Yes. Switch Output to "LLM structured output (strict)". The schema then follows strict-mode rules: an object at the root, additionalProperties: false on every object, every property listed in required (fields missing from some samples become nullable instead), items on every array and only supported formats. Paste it into response_format / json_schema with strict: true, a tool input_schema for Claude, or responseJsonSchema for Gemini.

Is my JSON uploaded anywhere?

No. Schema inference runs entirely in your browser, so API responses and private payloads never leave your device.

Related Tools

JSON Schema Validator · JSON to TypeScript · JSON to Zod · JSON Generator

Browse all free JSON tools →

Related tools