JSON Schema Generator

Generate a JSON Schema from sample JSON, inferring nested objects and array item types.

Drop a file here
or click the button below to choose a local file
.json / .txt / .csv, up to 10 MB, parsed locally in your browser
Schema draft
Both drafts share the same core structure; only the $schema URI differs (no meaningless fields are added just to look different).
Required fields
Object properties
A single sample cannot tell which fields are business-required — feel free to edit the generated schema.
Everything runs locally in your browser. No data is uploaded.

Automatically generate a JSON Schema from JSON data

What is JSON Schema?

JSON Schema is a specification that uses JSON to describe the structure, field types, and constraints of JSON data. It can be used for API parameter validation, configuration checks, data validation, and structural descriptions in API documentation. This tool infers a structure from existing JSON data and generates a JSON Schema, making it useful for quickly creating an initial Schema.

How do you generate a Schema from JSON?

Paste JSON data into the input box or upload a local JSON file, select the Schema Draft and field options, and then generate the Schema. The tool identifies JSON types such as objects, arrays, strings, numbers, Booleans, and null based on the input data, then generates the corresponding Schema according to the actual nested structure.

What is the difference between Draft 2020-12 and Draft-07?

Draft 2020-12 and Draft-07 are different versions of the JSON Schema specification. When generating a Schema, choose the Draft version that matches the target validator, development framework, or existing Schema version used by the project. If the project has no specific requirement, you can start with the newer Draft 2020-12 and adjust it according to the actual runtime environment.

Why do generated fields become required?

When “Make all fields required” is enabled, the tool adds fields from the input JSON objects to the required array, meaning those fields must exist during validation. When disabled, fields are not automatically added to required. Note that required specifies whether a field exists; it does not mean that the field value cannot be empty.

What is additionalProperties?

additionalProperties controls whether an object may contain fields that are not defined in the Schema. When allowed, the input object can contain properties that are not listed. When prohibited, additional properties are considered invalid by the validator. Choose the setting according to whether the API requires strict field control.

How are nested objects and arrays generated?

For nested objects, the tool continues generating the corresponding properties structure. For arrays, it generates an items definition based on the array elements. Objects inside arrays are analyzed further, including their fields and nested levels, so a relatively complete structural Schema can be generated from an actual JSON example.

Why is the generated Schema only an initial set of rules?

Automatic generation can only infer structure from the current JSON example and cannot accurately determine every business constraint from a single sample. For example, a field being a number in the current sample does not mean future values must fall within a particular range. A field being present in the current sample does not necessarily mean it is always required by the business rules. After generating a Schema, you should refine it according to the actual API requirements by adding formats, ranges, enum values, descriptions, and other constraints.

How to generate a Schema from a local JSON file

Switch to the file upload tab and drag a JSON file into the upload area or select a local file. The browser reads and parses the file, and the generated result is displayed directly on the page. The JSON file does not need to be sent to the server. The generated Schema can be copied or downloaded for API validation or project configuration.

How to use the generated Schema

The generated Schema can be saved as a JSON file and passed to a validator that supports JSON Schema. When integrating it into a project, confirm the Draft version used by the project and the validator's support for the relevant keywords. If you need to check whether a JSON document conforms to a Schema, you can continue with the JSON Schema Validator.

How do you automatically generate a JSON Schema?

Paste JSON data into the tool, choose the JSON Schema Draft version and options such as required and additionalProperties, and the tool will automatically generate a Schema from the actual JSON structure.

The generated result is suitable as an initial Schema for API validation, data verification, or project configuration. Before using it in production, refine it with field formats, ranges, enum values, and other business constraints.

  • Automatically infers objects, arrays, strings, numbers, Booleans, null, and other JSON types
  • Generates corresponding properties and items from nested objects and array structures
  • Supports JSON Schema Draft 2020-12 and Draft-07
  • Choose whether all fields in input objects should be marked as required
  • Choose whether objects may contain additional properties not defined in the Schema
  • Everything runs locally in the browser, and input data is not uploaded to the server
If you already have a JSON Schema and want to check whether data conforms to it, use JSON Schema Validator. To query JSON fields, use JSONPath Query. To compare the structure and contents of two JSON documents, use JSON Diff.
Comments 0
No comments yet. Be the first to comment!
avatar
Comment content cannot be empty
0/255