Skip to main content

JSON Schema Generator

A validated contract, inferred from real data.

Paste a sample document and Jsonviewpro infers a JSON Schema: types for every property, required fields, merged array item schemas and detected string formats such as date-time, email and uuid.

Input JSON

Size: 0 BLines: 0

JSON Schema

Paste valid JSON to see the output.
Size: 0 BLines: 0

What is JSON Schema?

JSON Schema is a vocabulary for describing the shape of JSON data: which properties exist, what types they hold, which are required, and what constraints apply. It is a machine-checkable contract, used for API request validation, configuration validation, form generation and documentation.

How to generate a schema

  • Paste a representative document — ideally one with populated arrays and every optional field present.
  • Pick a draft. 2020-12 is current; draft-07 is still the most widely supported by tooling.
  • Choose whether every property should be required, or only those present in every sample.
  • Copy or download the schema, then refine it by hand.

What gets inferred

  • Types for every property, with integer distinguished from number.
  • Required arrays, derived either from all properties or from the intersection across array items.
  • Merged array item schemas, so a heterogeneous array produces one items schema that accepts each shape seen.
  • String formats: date-time, date, time, email, uuid, uri and ipv4.

Treat the output as a first draft

Inference can only describe the sample it was given. It cannot know that a status field takes one of four values, that an age must be at least 18, or that an array must not be empty. Add enum, minimum, maxLength, pattern and description by hand — that is where a schema earns its keep.

Once you have refined it, paste it into the JSON Validator to check real documents against it.

Frequently asked questions

Which drafts are supported?
Draft 2020-12, 2019-09, draft-07 and draft-04.
How are required fields decided?
By default a property is required when it appears in every sample object of that shape. You can also mark every property required and prune the list yourself.
Can I validate a document against the generated schema?
Yes — the JSON Validator checks documents against a schema locally and reports each violation with its path.
Will the schema include enums or ranges?
No. Those express intent that cannot be inferred safely from a sample, so they are left for you to add.