Skip to content
Emojar – free online tools

JSON Schema Generator

Paste a JSON sample and get a JSON Schema that describes it: types, nested objects, arrays and the keys every object has. Choose draft 2020-12, 2019-09 or draft-07, optionally forbid extra keys and detect formats such as date-time and email, then copy or download the schema.

This tool runs entirely in your browser.

Loading tool…

How to use the JSON Schema Generator

  1. 1Paste a representative JSON sample — ideally with every field your data can have.
  2. 2Pick the JSON Schema version (2020-12 is the default) and the options: required keys, no extra keys, and format detection.
  3. 3Copy or download the schema, then refine it by hand with limits, enums or descriptions.

What is the JSON Schema Generator?

JSON Schema is a vocabulary for describing the shape of JSON documents, used for API validation, form generation and documentation. This generator walks your sample and writes a type for every value: objects get properties, arrays get an items schema, integers and decimals are told apart, and strings that look like dates, emails, URIs or UUIDs can get a format.

When an array contains objects with different keys, they are merged: every key found becomes a property, and only keys present in every object are marked as required. Values of different types become a type list such as ["string", "null"], or an anyOf when the shapes differ. The result describes the sample you pasted, not every rule of the real data contract, so review it before relying on it.

In-depth guide

How to Generate a JSON Schema from Sample JSON (and Tighten It) →

Frequently asked questions

Which JSON Schema version should I choose?

Draft 2020-12 is the current version and the default. Choose draft-07 if your validator or tool (many older libraries and OpenAPI 3.0) doesn’t support newer drafts. For the schemas this tool produces, the only difference is the $schema URI.

How are arrays with mixed objects handled?

All objects in the array are merged into one schema. A key that appears in only some objects becomes an optional property; the required list contains only keys that every object has.

Is the generated schema complete?

It matches your sample, but it can’t know rules the sample doesn’t show — maximum lengths, allowed values, number ranges or optional fields that happen to be missing. Treat it as a starting point.

Is my JSON uploaded?

No. Parsing and inference run in your browser, so you can safely paste API responses with real data.

Is the JSON Schema Generator free and private?

Yes. The JSON Schema Generator is free, needs no account, and runs entirely in your browser. What you type is never sent to a server or stored.