Processed locally

JSON to JSON Schema Generator Online

Generate JSON Schema Draft 2020-12 locally from JSON sample(s) with primitive and complex type inference, required field controls, format detection, and diagnostics.

What this tool does

JSON to JSON Schema Generator infers valid JSON Schema Draft 2020-12 documents locally from JSON sample objects or arrays. It supports single and multi-sample analysis, conservative format detection, configurable required fields and additionalProperties policies, and self-validates samples against the generated schema without network uploads.

How to use

Follow the core workflow below. Use “Show in tool” to locate the real control in the live tool above.

  1. Choose one sample or multiple samples

    Use Single sample for one representative payload, or open Multiple samples to infer optional fields and shared structure across examples.

    Single sampleMultiple samples
  2. Compare multiple samples when fields may be optional

    Optional

    Open Multiple samples to add representative payloads and distinguish fields that are always present from fields that are optional.

    Multiple samples+ Add sample
  3. Add a representative JSON sample

    Paste a representative JSON value. In Multiple samples mode, add up to five examples of the same payload shape.

    JSON sample+ Add sampleLoad sample
  4. Choose how the schema should be inferred

    Set required-field behavior, additional-properties policy, and optional conservative format inference before generating the schema.

    Required fieldsAdditional propertiesInfer common string formatsInclude examples
  5. Generate the JSON Schema

    Generate a Draft 2020-12 schema locally from the supplied samples.

    Generate Schema
  6. Review inference diagnostics and sample validation

    Check optional fields, unions, empty structures, inferred formats, and confirm that every provided sample validates against the generated schema.

    DiagnosticsSample self-validationWarnings
  7. Copy or download the generated schema

    Review the schema, then copy it or download a .schema.json file for validation, tests, or documentation.

    Copy SchemaDownload .schema.json
Success

You have generated a standard JSON Schema Draft 2020-12, verified sample self-validation, and exported your schema locally.

Copy SchemaDownload .schema.json

Examples

API response object

Infer property types, required fields, and nested object constraints from a single payload sample.

Optional field across two samples

Compare two samples to automatically detect optional fields when a property is omitted in one payload.

Nullable field

Infer nullable type arrays when a property contains null in one sample and a string in another.

Heterogeneous array items

Generate anyOf or type arrays when array elements contain mixed primitive or object types.

Empty array & object warnings

Receive diagnostic warnings when empty structures leave item or property types underdetermined.

Common errors

  • Assuming an inferred schema automatically discovers hidden business rules like minimum, maximum, or regex patterns.
  • Treating a single sample as proof that every observed property is permanently required in all API responses.
  • Over-inferring strict string formats from ambiguous string values.
  • Generating enum constraints from a single observed string value.
  • Ignoring empty array and empty object diagnostic warnings when defining target schemas.

AI workflow

Review the inferred schema first, then use the generated JSON Schema directly in validation, documentation, tests, or a coding-agent workflow. Inference describes the samples you provided; it does not discover hidden business rules.

Learn with this tool

Understand the concept, inspect a testable example, then open it in the tool above.

JSON & SchemaJSON Schema enum: Allowed Values and ExamplesJSON & SchemaJSON Schema additionalProperties ExplainedJSON & SchemaJSON Schema oneOf vs anyOf vs allOf

Frequently asked questions about JSON to JSON Schema Generator