JSON to JSON Schema

Generate a JSON Schema (draft 2020-12) from any JSON sample.

Runs instantly in your browser — results update as you type.

What is JSON Schema?

JSON Schema is a standard vocabulary for describing the structure of JSON data — which properties exist, their types, which are required and what formats they follow. It is used to validate API requests and responses, generate documentation and power form builders.

What the generator infers

  • Types — string, integer, number, boolean, null, object and array.
  • Objects — every property, with all properties marked required (edit afterwards for optional fields).
  • Arrays — item schema inferred from the first element.
  • Formats — strings that look like an email, ISO date-time or URI get a format keyword.

Example

Input : {"name":"URLMode","tools":90,"site":"https://urlmode.com"}
Output: { "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": { "name": {"type":"string"}, "tools": {"type":"integer"},
                  "site": {"type":"string","format":"uri"} },
  "required": ["name","tools","site"] }

After generating

  1. Remove fields from required that are optional.
  2. Add constraints: minLength, maximum, enum, pattern.
  3. Merge variations if items in an array can differ (anyOf).
  4. Validate real data against the schema with your language's validator (Ajv for JavaScript, jsonschema for Python).

Format or validate your sample first with the JSON Formatter. Everything runs in your browser.

Frequently asked questions

How do I create a JSON Schema from JSON?

Paste a representative JSON sample. The generator outputs a draft 2020-12 schema with types, properties, required fields and formats.

Which JSON Schema version is used?

Draft 2020-12, the current version, declared in the $schema keyword.

Why is every field required?

A single sample cannot show which fields are optional. Remove optional fields from the required list after generating.

Is JSON Schema the same as schema.org?

No. JSON Schema validates data structures; schema.org structured data describes web content for search engines.