Code tool

JSON Schema Generator

Paste one JSON value per line to create a structural schema draft. Add multiple samples to reveal optional properties and mixed types, then edit the result to match your real data contract.

In-browser processingNo account requiredPrivacy details ↗

Enter one complete JSON value per line. Multiple samples help infer optional properties and mixed value types. Up to 2 MB total. Standard JSON only.

Generated schema uses JSON Schema Draft 2020-12. It describes observed structure, not business rules, formats, ranges, or all possible values. A sample array is treated as one JSON value.

Add one or more JSON samples to begin.

A QUICK WALKTHROUGH

How to use this tool

  1. Paste one complete JSON sample per line, up to 2 MB total.
  2. Generate a Draft 2020-12 schema and review inferred types, properties, required fields, and array items.
  3. Edit the schema as needed, then copy or download the valid JSON.

Inference from the supplied samples

The generator examines standard JSON values and merges their observed structure. For objects, a property is marked required only when it appears in every observed object at that level. Arrays merge the structures of their observed items. Different JSON types are kept as a type union.

A draft to review, not a finished contract

Samples cannot reveal every valid value. The generator does not infer formats, numeric or string bounds, business rules, enum values, or closed-object policies. The generated schema is editable; review it against the actual producer and consumer before relying on it.

JSON Schema Draft 2020-12, locally

Output declares JSON Schema Draft 2020-12. Paste one complete JSON value per line; a JSON array on a line is treated as one sample value. Input is limited to 2 MB total and remains in the browser. Editing, copying, and downloading do not upload samples.

GOOD TO KNOW

Common questions

How are required properties chosen?

A property is required only if it appears in every object sample observed at that same object level. With one sample, every property in that object is marked required, so include representative samples to expose optional fields.

Does it validate all my data against the generated schema?

No. It generates and lets you edit a schema draft. It does not implement JSON Schema validation; use a dedicated validator to validate data.

Does the generator infer formats or allowed values?

No. Samples alone do not establish rules such as email format, date-time format, ranges, enums, or business constraints. Add those deliberately in the editable schema.

Are my samples uploaded?

No. Parsing and schema inference happen locally in your browser.