About the JSON Schema Generator
Paste a JSON document and get a matching JSON Schema in seconds. The generator walks the structure, infers the type of every property — strings, numbers, integers, booleans, nulls, arrays and nested objects — and produces a schema you can use to validate API payloads, document your data model, drive form generation or seed an OpenAPI definition. Everything runs in your browser.
What JSON Schema is for
JSON Schema is a vocabulary for describing the shape of JSON data: which properties exist, what types they hold, which are required, and constraints such as string formats or numeric ranges. Validators exist for every major language (Ajv for JavaScript, jsonschema for Python, everit for Java), so a single schema can enforce the same contract in a browser form, a Node API and a data pipeline. It also underpins OpenAPI request and response definitions, VS Code's settings and config-file IntelliSense, and low-code form builders.
What the generator infers
- Primitive types — string, number, integer (for whole numbers), boolean and null.
- Objects — a properties block for each key with its own nested schema.
- Arrays — an items schema based on the first element, so arrays of objects produce a full object schema.
- Nesting — arbitrarily deep structures are handled recursively.
Turning the draft into a production schema
- Add a required array listing the properties that must always be present; a generator cannot know which fields are optional.
- Tighten types: add format (email, date-time, uri), enum, minimum/maximum, minLength/maxLength and pattern where appropriate.
- Set additionalProperties: false on objects whose shape is fixed, so unexpected keys are rejected.
- Declare the draft with $schema (for example https://json-schema.org/draft/2020-12/schema) and give the schema a $id and title.
- Feed several representative samples through the generator and merge the results so optional and nullable fields are captured.
How to use the JSON Schema Generator
- 1Paste JSON. Drop a JSON object or array into the input panel. Parsing errors are shown immediately.
- 2Review the schema. The generated JSON Schema appears in the output panel, formatted and ready to read.
- 3Copy. Click Copy and paste the schema into your validator, OpenAPI file or project.
Frequently asked questions
- Which JSON Schema draft does the output follow?
- The structure — type, properties, items — is compatible with every draft from 04 through 2020-12. Add the $schema keyword for the draft your validator expects.
- Why are all my fields optional in the generated schema?
- A single sample cannot reveal which properties are mandatory. Add a required array yourself, listing the keys that must always be present.
- How are arrays with mixed types handled?
- The items schema is inferred from the array's first element. For heterogeneous arrays, edit the schema to use anyOf or oneOf with each expected shape.
- Is my JSON sent to a server?
- No. Parsing and generation run in your browser, so real API payloads and customer data stay on your device.