JSON Schema Generator Free
Auto-generate a JSON Schema from any JSON sample. Infers types, detects required fields, handles nested objects and arrays. Output is Draft 7 compatible — ready for validation libraries. Runs entirely in your browser.
JSON Input
JSON Schema Output
Pro — merge schemas from multiple samples, pattern detection, enum inference, API
API access · Priority queue · Team workspace
How It Works
Paste Your JSON
Paste any JSON — an object, an array of objects, or a nested structure. Click Sample JSON to load a complete user profile with nested address, array of roles, boolean flags, and numeric fields. The generator infers the schema from the actual values in the input, so the more representative your sample data, the more accurate the resulting schema.
Configure Options
Choose whether all present keys should be marked as required in the schema (conservative and strict), whether examples from the input values should be included in the schema (helpful for documentation), whether to add a title and description field, and whether to set additionalProperties: false to reject any extra keys not defined in the schema.
Copy or Download
Click Generate Schema to produce a Draft 7 compatible JSON Schema instantly. Copy to clipboard to paste into your codebase, API documentation, or OpenAPI spec. Download as schema.json to use directly with ajv, jsonschema (Python), javax.validation, or any other JSON Schema validator. Review and edit the output to add additional constraints like minLength, format, or enum values.
JSON Schema Generator Features
Draft 7 compatible schema inference with type detection and nesting support
Accurate Type Inference
Detects all JSON Schema primitive types: string, number, integer (when the value has no decimal part), boolean, null, object, and array. Strings that match common formats like dates, email addresses, and URIs are annotated with a format hint. Integer detection prevents using a number schema for values that are always whole numbers, producing a tighter, more precise schema.
Nested Object Support
Recursively generates schemas for nested objects and arrays. A nested address object produces a nested properties definition with its own type annotations. Arrays of objects produce an items schema inferred from the first array element. Arrays of primitives produce a simple typed items schema like {"type":"string"}.
Required Fields Detection
When "Mark all keys as required" is enabled, every key present in the input JSON is added to the required array of the schema. This produces the strictest possible schema. Disable this option if your data is sparse or optional fields are common — the required array will be omitted and all fields become optional. You can then manually add required annotations to the fields you care about.
Examples from Input
When enabled, each property in the schema gets an examples array containing the actual value from the input JSON. This is helpful for auto-generated API documentation (Swagger/OpenAPI 3.0 supports schema examples), makes the schema self-documenting, and helps developers understand expected values without reading separate API docs or sample payloads.
additionalProperties: false
Adding additionalProperties: false to the schema means any JSON document with extra keys not defined in the properties will fail validation. This is a strict mode useful for API request validation where unexpected fields should be rejected. Leave it off (default) for a more permissive schema that only validates the fields it knows about, allowing additional keys to pass through.
100% Private
Schema generation runs entirely in your browser — your JSON is parsed locally and the schema is constructed in-memory. No data is sent to a server at any point. Safe for JSON samples containing real production data values, PII, financial figures, or internal API response structures that must not be transmitted externally. Compatible with offline use after page load.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| JSON input size | Unlimited | Unlimited |
| Draft 7 schema output | ||
| Merge schemas from multiple samples | — | |
| Enum inference | — | |
| Pattern & format detection | Basic | Advanced |
| REST API access | — |
Frequently Asked Questions
JSON Schema is a vocabulary for annotating and validating JSON documents. It describes the structure, data types, and constraints of a JSON document using a schema that is itself expressed as JSON. It is widely used for API request/response validation, form validation, documentation generation, and IDE autocompletion. The most common draft used today is Draft 7, followed by Draft 2020-12.
Draft 7 is supported by ajv (JavaScript/Node.js — the most popular), jsonschema (Python), JsonSchema.NET (C#), everit-org/json-schema (Java), justinrainbow/json-schema (PHP), and gojsonschema (Go). The schema generated here can be used directly with any of these libraries. Add your desired validation constraints (like minLength, pattern, minimum) after generating the base schema.
The schema is inferred from a single JSON sample — it captures types, structure, and required keys, but cannot know your full business constraints (like a string must match a specific pattern, or a number must be between 0 and 100). Think of the output as a solid starting point that captures the shape of your data. You should review and extend it to add validation constraints like minimum, maximum, minLength, maxLength, pattern, and format before using it in production.
Yes — OpenAPI 3.0 uses a subset of JSON Schema Draft 7 for its schema objects. Paste the generated schema into the components/schemas section of your OpenAPI spec. Note that OpenAPI has some restrictions (like not supporting all Draft 7 keywords), so remove any unsupported keywords if your tooling complains. The core type, properties, required, and items keywords are always compatible.
Setting additionalProperties: false means that a JSON object being validated against this schema must contain only the properties explicitly listed in the properties definition — no extra keys are allowed. This is a strict mode often used for API request bodies to reject unexpected fields. Leave it out (default) for lenient validation that allows extra keys. Note that this can cause issues when your schema evolves and new fields are added.
No — schema generation runs entirely in your browser. Your JSON is parsed using JSON.parse() and the schema is constructed in JavaScript memory, then displayed in the output field and optionally downloaded to your device. No network requests are made during generation. This makes it completely safe to generate schemas from JSON samples that contain real production data, user PII, or internal API response structures.