Schema authoring workflow

Generate a starting schema from real JSON

Writing a schema by hand is slow. Start from a real example and adjust the parts that need stricter rules.

01

Treat the generated schema as a draft

Generation infers types from one example. Confirm the rules against real variation.

1

Paste a representative sample

Choose an example that includes optional and nested fields.

2

Generate the draft schema

Review the inferred types for every property.

3

Adjust required fields

Remove fields that are not always present in production data.

4

Test against more samples

Validate additional payloads before adopting the schema.

02

How the generator reads your example

The generator inspects a representative document and infers types, required keys, and item types. An object with three keys becomes a schema with three properties, and keys present in every object are marked required.

Treat the output as a starting point: add constraints such as minimum and maximum, or enum values, before using it in production.

  • Root type is inferred from the top-level value
  • Required is derived from keys present in every example object
  • Array item types come from the first items
  • Numbers and strings keep their basic types
03

Limits of generating from one example

  • Optional fields can look required
  • A single example cannot show every type variation
  • Numeric strings and real numbers can be confused
  • Enum candidates are not always obvious from one sample
04

Refine before adopting

  • Generate from more than one example when possible
  • Loosen required fields that are sometimes absent
  • Add format hints for dates and identifiers
  • Store the schema next to the API documentation
05

Frequently asked questions

Is the generated schema valid?

Yes. The output follows JSON Schema draft-07 and can be validated and used immediately.

Why are some keys not required in my schema?

Required is derived from keys that appear in every object of the example. Optional keys in the example stay optional in the schema.

Can I add constraints to the generated schema?

Yes. Extend the output with minimum, maximum, pattern, or enum keywords before validating real data.

Does the generator upload my example?

No. Generation runs locally in your browser.

06

Sample data stays local

Schema generation runs in the browser. Avoid pasting production secrets into the sample payload.

Open JSON Schema Generator