Skip to content

JSON

JSON Schema Generator

Generate a draft-07 JSON Schema from sample data, combining array types and making required fields and extra properties explicit.

How to use this tool
  1. Paste example JSON data.
  2. Choose whether common fields are required and additional properties are forbidden.
  3. Generate, review and download the draft-07 schema, then test it against representative data in the validator.

Generate JSON Schema from Sample Data

Loading tool…

Find this tool in

About this tool

What is JSON Schema Generator?

Infer a starter JSON Schema from representative JSON data, then review the contract it proposes. Choose whether observed properties should be required and whether additional properties should be disallowed. A sample reveals what appeared in that sample; it cannot establish every valid future value or the application's intended rules.

A worked example

Infer a numeric property without inventing a numeric constraint

Example input

{"count":2}

Expected result

"count": {
  "type": "number"
}

Generate the schema and inspect the count property. This excerpt shows its inferred type. The tool does not infer that every future value must be a positive integer, nor that the value must equal two. Review required properties, numeric bounds and optional fields against the intended API before validating production data.

Common mistakes and limits

  • One sample cannot establish whether an absent field is optional or invalid. Include representative cases and review required-property settings.
  • Closing an object to additional properties is a deliberate contract choice. Do not assume it follows automatically from the keys seen in one record.

Features

What you can do

  • Nested object and array inference.
  • Mixed-type anyOf schemas and merged object samples.
  • Required fields based on presence in every sampled object of the same group.
  • Explicit additionalProperties option.
  • Local copy and JSON download without uploads.

Frequently asked questions

Questions about JSON Schema Generator

Does one JSON example define all valid future data?

No. Inference only sees the supplied values. It cannot discover missing optional fields, business rules, allowed string formats or valid numeric ranges. Treat the output as a starting point and review it before using it to accept or reject data.

Why are whole numbers generated as number instead of integer?

A sample that happens to contain whole numbers does not prove that decimals are forbidden. The generator deliberately uses number without range restrictions and does not copy numeric examples into the schema. Add stricter rules when your actual contract requires them.

Which sample sizes and schema version are supported?

The output uses JSON Schema draft-07. Samples are limited to 500,000 characters, 50,000 values and 80 nesting levels; output is limited to 1,000,000 characters.

Related tools