Skip to content
Tezmy Tools

JSON Schema Generator

Create a JSON Schema from a sample JSON document

Built from one sample, so check types and required keys before you rely on it.

Runs in your browser. Nothing is uploaded.

About the JSON Schema Generator

A JSON Schema describes what valid data looks like, and it powers validation, form builders and API documentation. Writing one by hand is tedious, so this generator infers it from a sample. Paste an example document and you get a schema with the right types, nested properties, array item types and, if you choose, required keys, string formats and example values. It recognises dates, date-times, emails, URLs and UUIDs. You can pick draft-07 or 2020-12. The schema is only as good as the sample, so review the output and loosen or tighten it before you use it. All processing happens in your browser.

Updated October 2026

How to use the JSON Schema Generator

  1. 1Paste a representative JSON sample.
  2. 2Choose the schema version, draft-07 or 2020-12.
  3. 3Decide whether every key should be required.
  4. 4Turn on format guessing and examples if you want them.
  5. 5Copy the schema into your validator, form builder or documentation.

What goes into the schema

Each value in the sample becomes a type. Whole numbers are integer, other numbers are number, and strings are string. Objects turn into a properties map, and arrays get an items schema built from all the elements, so a list of users yields one schema that describes each user.

Because the schema describes the shape, not the exact values, it can validate other documents of the same shape. Add examples to document the fields, but remember that examples are not rules.

Remember that a schema built from one example can be too strict. If a field is a number in your sample but the API sometimes sends a string, validation will fail on real data. Paste an array with several different examples, and the tool will merge the types for you into a single schema that accepts all of them.

Making the schema stricter

  • Add minimum and maximum for numbers that have limits.
  • Add enum for fixed choices, like status values.
  • Set additionalProperties to false if unknown keys should be rejected.
  • Use pattern for codes and ids with a fixed layout.
  • Add minLength or maxLength for text fields.

Related tools

Confirm your sample parses with the JSON Validator and tidy it with the JSON Formatter. If you want types for code instead, the JSON to TypeScript Converter writes interfaces, and the Random JSON Generator makes test data to try against your schema. For tabular sources start with the CSV to JSON Converter.

Features

  • Draft-07 and 2020-12
  • Nested objects and arrays
  • Integer and number detected
  • Format guessing: date, date-time, email, uri, uuid
  • Optional required keys and examples
  • Arrays of objects merged into one item schema
  • Private, no upload

Frequently asked questions

What is JSON Schema?

It is a standard way to describe the structure of JSON: which keys exist, what types they have and which values are allowed. Validators use it to accept or reject data.

How accurate is a generated schema?

It is a draft inferred from one sample. It cannot know about limits such as minimum values or allowed words, so add those by hand.

Why are all keys required?

That is the safest default for a sample. Turn the option off if some keys are optional, and the schema will omit the required list.

How are arrays of objects handled?

The objects are merged into one items schema. Keys that appear in every object are required, and the others are optional.

Which draft should I use?

Draft-07 is supported almost everywhere. Use 2020-12 if your validator supports it and you want the newer keywords.

What do the formats do?

Formats such as email or date-time are hints, and many validators check them only when you ask. They help documentation and form tools show the right input.

Does it validate my data?

No, it creates the schema. To check data against a schema, use a validator library or your API gateway.

Related tools