Generate a JSON Schema draft from representative JSON data. This JSON Schema generator infers object structure, arrays, basic data types, and selected string formats, then lets you review, copy, or download the generated schema for validation, API documentation, and development workflows.
Analyze a representative JSON object or array and generate a starting JSON Schema that describes its observed structure and basic data types.
Recursively infer nested object properties and array item schemas. Review arrays with mixed or incomplete item structures before using the result as a validation contract.
Choose whether fields observed in the sample should be added to the required array. A single example cannot reliably prove that every observed field is required in all future data.
Choose whether generated object schemas allow properties that were not present in the sample. Use strict settings carefully because real payloads may contain fields not included in the example.
Optionally detect common string patterns such as email, date, date-time, URI, and UUID when the value matches the implemented detection rules. Detected formats are guesses based on the sample and can be turned off.
Choose the JSON Schema draft supported by your validator or documentation tool. Draft-07 has broad compatibility, while newer drafts provide newer vocabulary and behavior.
Copy the generated schema or download it as a .json file for use with validators, API documentation, tests, form tools, or code-generation workflows.
JSON parsing and schema generation happen in your browser. The page does not require an account or upload the sample data to a remote service.
Paste an example object, an array of records, or a local JSON file if file input is available. Include examples of optional fields and different array item shapes when those variations matter.
Select Draft-07 or Draft 2020-12 according to the validator, API tool, or documentation system that will consume the schema.
Choose whether observed fields should be required, whether additional properties are allowed, whether common string formats are detected, and whether examples are included.
Click Generate Schema, then review types, required fields, array items, formats, additionalProperties, and any warning that the result is inferred from sample data.
Copy or download the schema, then test it against representative valid and invalid documents. Add constraints such as enum, pattern, minimum, maximum, or minLength manually when needed.
{
"name": "Alice",
"age": 30,
"email": "alice@example.com",
"tags": ["admin", "user"]
}{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
},
"email": {
"type": "string",
"format": "email"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"age",
"email",
"tags"
],
"additionalProperties": true
}JSON Schema is a vocabulary for describing the structure and validation rules of JSON documents. It can define object properties, arrays, data types, required fields, formats, value constraints, and whether additional properties are allowed.
A JSON Schema generator analyzes one or more JSON examples and creates a starting schema. The generated result is useful for reducing manual work, but it still needs review because sample data cannot reveal every optional field, alternative type, boundary value, or business rule.
Type inference is based on observed values. It does not automatically know whether a numeric field is a count, price, identifier, timestamp, or version string.
If a property appears in one sample, that proves only that it appeared in that sample. It does not prove that every valid document must contain it. Use the required option as a starting point, then compare multiple examples or edit the required array based on the real API or data contract.
A single JSON object may omit optional fields or show only one branch of a conditional structure. Multiple representative samples can reveal:
If the generator accepts only one JSON input, combine representative records into an array or review the resulting schema manually with additional samples.
Setting additionalProperties to false makes an object schema strict: properties not listed in the schema are rejected. This can detect unexpected fields, but it can also reject legitimate fields that were absent from the example. Allowing additional properties is more tolerant and may be safer for evolving APIs.
Values such as email addresses, URLs, UUIDs, IP addresses, dates, and hostnames can sometimes be recognized by pattern. A format hint is not the same as a complete validation rule, and detection can produce false positives or miss valid values. Review generated formats before relying on them.
A generator can infer that a value is a number, but it usually cannot know the correct business limits. Add rules such as minimum, maximum, minLength, maxLength, pattern, enum, oneOf, or anyOf based on documented requirements rather than guessing from one example.
JSON Schema Draft-07 is widely supported by existing validators and tools. Draft 2020-12 is newer and uses updated vocabularies and behavior. The correct choice depends on your validator, API documentation generator, form library, or code-generation workflow. Include the appropriate $schema URI and test the result with the exact toolchain you plan to use.
A generated schema is a useful starting point, not automatically a complete production contract. Before publishing it, review required fields, optional fields, nullability, numeric ranges, string formats, enum values, additional properties, array item rules, property names, and security-sensitive fields.
This generator is designed to parse the sample JSON and create the schema in the browser rather than sending the input to a remote service. That can be useful for development and documentation. Avoid entering credentials, access tokens, private customer records, or confidential production payloads into any online tool.