JSON Schema Generator Online Free

Paste one JSON object or a whole array of objects. The tool merges them into a draft-07 schema with union types, enums, formats and $defs, then validates every sample against the result.

✓ Multi-sample merge ✓ Enum and format inference ✓ Round-trip validation ✓ No uploads

Samples

An array of objects is split into one sample per element. A single object, scalar or array of scalars is added as one sample.

Loaded samples (0)

  • No samples yet. Paste JSON on the left.

Generation options

Enum threshold: distinct values

Generation report

    Everything runs on your device.
    • Parsing, merging and generation happen in this tab.
    • Validation runs the samples through the finished schema, including $ref resolution.
    • The schema, samples and report are never sent anywhere.
    • Nothing is stored, logged or emailed.

    How to Generate a JSON Schema From Sample JSON

    One example rarely describes a real payload. The generator treats every input as evidence:

    1. Add your samples - Paste a single object, or paste an array of objects and each element becomes a separate sample. Upload a JSON file if that is easier. The list on the right shows every loaded sample.
    2. Set the options - Enum threshold decides when a string field becomes an enum, formats can be inferred for emails, UUIDs, URIs and dates, shared shapes collapse into $defs, and required keys only include fields found in every sample.
    3. Generate - The schema appears as formatted draft-07 JSON with $schema, title, properties, required, enums, formats, union types and $defs with $ref links. Copy it or download schema.json.
    4. Read the validation report - Every sample is validated against the finished schema. The report lists samples merged, enums and formats detected, union types, $defs shapes, and one pass line per sample.

    Why Merging Multiple Samples Beats a Single Example

    A schema built from one object guesses. A schema built from five objects knows:

    • Union types - A field that is null in one sample and a string in another becomes [null, string], so the schema accepts what your API actually returns instead of failing on the second record.
    • Honest required lists - Required includes only keys present in every sample. Optional fields never fail validation just because one example skipped them.
    • Enum detection - Status, role, country and similar fields with small value sets become enums automatically, with the threshold in your control.
    • Format inference - email, uuid, uri, date and date-time patterns are attached only when every string sample matches, so misformatted values do not smuggle in a format.
    • $defs dedupe - Two fields with the same object shape share one definition behind $ref, which keeps the document small and consistent.

    Generate and Validate JSON Schema Without Uploading Data

    Samples are usually taken straight from production traffic or a partner spec, which makes them the wrong files to paste into an unknown service. This page parses, merges, generates and validates entirely in the browser, then hands you the schema file. For related data work, convert payloads with the JSON to CSV Converter or reconcile two exports with Compare Two CSV Files. After shipping, check site health with the Free SEO Audit Tool or book our SEO audit services.

    Frequently Asked Questions

    How do I generate a JSON Schema from sample JSON?

    Paste one JSON object, or paste an array of objects so each element becomes its own sample. The schema rebuilds after every change, shows up in the output box, and downloads as schema.json whenever you want it.

    What does merging multiple samples change?

    Types become unions when samples disagree, for example a field that is null in one sample and a string in another becomes [null, string]. Required keys only include fields that appear in every sample, so optional fields never block valid data.

    When does it create an enum?

    When a string field has at most the configured number of distinct values across all samples, 8 by default. You can change the threshold or switch enum detection off entirely. Arrays of strings get the same treatment on their items.

    Which formats are detected?

    Email, UUID, absolute URI, date (2026-01-31) and date-time (ISO 8601 with time and zone). A format is only attached when every string sample for that field matches the same format.

    What are $defs in the generated schema?

    When two or more fields share an identical object shape, the shape is stored once under $defs and reused with $ref. The schema stays small and edits stay consistent instead of repeating the same block ten times.

    Does it validate the samples after generating?

    Yes. Every sample is run back through the finished schema, including $ref resolution, required keys, enums, types and formats. The report shows a pass line per sample with the exact path if anything fails.

    Is my JSON uploaded?

    No. Parsing, merging, generation, the $defs pass and validation all run in this tab. Your samples, the schema and the report never leave the device.