JSON to JSON Schema Generator — Free Online Tool
Generate a JSON Schema (Draft 7) from any JSON object using AI. Infers types, required fields, nested object schemas, and array item types automatically. Free, no sign-up.
Related Guides
JSON to JSON Schema Generator — Free Online Tool
About JSON to JSON Schema Generator — Free Online Tool
JSON to JSON Schema generates a Draft 7 JSON Schema from any JSON sample, inferring types, required fields, and structural constraints automatically. Developers use it to bootstrap schema validation for APIs, configuration files, and data pipelines without writing schema definitions by hand.
JSON Type to JSON Schema Type Mapping
| JSON Value Example | Inferred type | Additional keywords added |
|---|---|---|
| "hello" | string | none (minLength added if non-empty) |
| 42 | integer | none |
| 3.14 | number | none |
| true / false | boolean | none |
| null | null | none |
| {"key": "value"} | object | properties, required |
| [1, 2, 3] | array | items (schema of first element) |
| [] | array | items: {} |
| ["a", 1] | array | items: oneOf with all observed types |
JSON Schema Draft 7 vs Alternatives
| Feature | Draft 7 | Draft 2019-09 | Draft 2020-12 | OpenAPI 3.0 Schema |
|---|---|---|---|---|
| $schema URI | http://json-schema.org/draft-07/schema# | https://json-schema.org/draft/2019-09/schema | https://json-schema.org/draft/2020-12/schema | N/A (inline subset) |
| if / then / else | Yes | Yes | Yes | No |
| $recursiveRef | No | Yes | No (replaced by $dynamicRef) | No |
| $dynamicRef / $dynamicAnchor | No | No | Yes | No |
| unevaluatedProperties | No | Yes | Yes | No |
| prefixItems (tuple) | No | No | Yes (replaces items array) | No |
| nullable keyword | No | No | No | Yes (OpenAPI extension) |
| Broad validator support | Excellent | Good | Growing | OpenAPI tooling only |
Frequently Asked Questions
How do I generate a JSON Schema from an existing JSON object?
Paste your JSON into a JSON to JSON Schema tool and it will traverse every key and value, infer the type of each field, mark all top-level keys as required, and emit a valid Draft 7 schema. The output is ready to use with validators like Ajv, jsonschema (Python), or Newtonsoft.Json.Schema.
What JSON Schema draft does the generator produce?
This tool targets JSON Schema Draft 7 (http://json-schema.org/draft-07/schema#), which is the most widely supported draft across validators and code generators as of 2025. Draft 7 is compatible with Ajv 6/8, jsonschema 4.x, and is the default for tools like quicktype and json-schema-to-typescript.
Does the generated schema mark all fields as required?
By default, all keys present in the sample JSON are added to the required array, because the generator cannot know which fields are truly optional from a single example. You should manually remove keys from required that your application treats as optional before using the schema in production validation.
How are nested objects and arrays handled in the schema output?
Nested objects are recursively converted into nested properties blocks, each with their own type: object and required array. Arrays are given an items keyword whose value is the inferred schema of the first element; if the array is empty, items defaults to {}. For mixed-type arrays, items uses a oneOf listing each observed type.
Can I use the generated JSON Schema for API request validation with Ajv?
Yes. Copy the output schema and pass it to ajv.compile(schema) — the Draft 7 output is directly consumable by Ajv 6 and Ajv 8 (with the draft-07 option). For Express or Fastify, you can drop the schema straight into a route's schema.body definition for automatic request validation.
If jsondecode.com saved you time, share it with your team
Free forever. No ads. No sign-up. Help other developers find it.