JSON Schema Generator - Generate a Schema from JSON

Schema Generator

Loading schema generator...

JSON Schema Generator

Generate JSON Schema from JSON with this browser-based schema generator. Paste an object or array to infer property types, nested structures, formats, and required fields, then review and edit the generated Draft 2020-12 schema. Your input is processed in the browser.

Generate a JSON Schema from a sample

Paste a JSON object or array into the generator. It infers property types, nested objects, array item shapes, and common string formats, then produces a JSON Schema Draft 2020-12 document that you can edit, copy, or download. The generator does not select a draft version; its output uses 2020-12.

Sample JSON

{
  "id": 17,
  "name": "Ada",
  "tags": ["admin", "active"],
  "profile": { "email": "ada@example.com" }
}

Inferred schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": { "type": "integer", "examples": [17] },
    "name": { "type": "string", "examples": ["Ada"] },
    "tags": { "type": "array", "items": { "type": "string", "examples": ["admin"] } },
    "profile": {
      "type": "object",
      "properties": {
        "email": { "type": "string", "format": "email", "examples": ["ada@example.com"] }
      },
      "required": ["email"]
    }
  },
  "required": ["id", "name", "tags", "profile"]
}

Required fields and sample coverage

With Infer Required enabled, non-null fields in a single object are marked required. For an array of objects, a field is required only if it appears in every sampled item. Null values remain represented in the schema, and mixed array item types are combined. This describes the sample you provide; review required fields and other business rules before using the schema as an API contract.

  1. 1. Paste a representative JSON object or array.
  2. 2. Configure required fields, descriptions, examples, and strict mode.
  3. 3. Review the generated schema, then copy or download it.

Key Features

Generate JSON Schema Draft 2020-12 from a JSON object or array
Infer nested object and array item properties from sample values
Optionally mark fields as required based on the supplied sample
Represent null and mixed values in the inferred schema
Choose whether to add descriptions, examples, or strict object rules
Review and edit the schema, then copy or download it
Input and schema generation stay in your browser

Privacy & Security

The JSON Schema Generator processes the data you paste or open in your browser. Shared links can contain that data in the URL, so check the link before sending it to someone else.

Large Dataset Support

Processing time and available file size depend on the input and your browser's memory and processing capacity.

Frequently Asked Questions

Which JSON Schema version does the generator create?

The generator emits JSON Schema Draft 2020-12 and does not currently provide a draft version selector.

Does it handle nested objects and arrays?

Yes. It recursively analyzes nested objects and array items up to 50 levels deep. For arrays, it samples up to 20 items to infer the item schema.

How are required fields inferred?

When Infer Required is enabled, non-null fields in an object are marked required. For arrays of objects, a field is required only when it appears in every sampled item. This reflects the examples you provide, so review it against your application rules.

What should I review before using the generated schema?

Review required fields, nullable values, and application-specific rules against more examples. Empty arrays leave the item type open. When merging multiple object items, the generator can omit Strict Mode's additionalProperties rule; check and edit the output if you need to reject extra fields.

Is my JSON uploaded when I generate a schema?

No. The JSON and generated schema are processed in your browser. A share link can include your input in its URL, so share it only with people who should see that data.