JSON Schema Generator from JSON

Infer a JSON Schema from a sample document, giving you types, required fields and nested structures as a draft to tighten by hand.

Output

How to use

  1. Paste a representative JSON document.
  2. A schema is inferred from its shape.
  3. Copy the schema and tighten it by hand.

Frequently asked questions

How good is an inferred schema?

It is a correct starting point, not a finished contract. Types and structure come out right; constraints such as formats, ranges and enums have to be added by you.

Are all fields marked required?

Fields present in the sample are treated as required, which is usually too strict. Go through and relax the ones that are genuinely optional.

What about a field that is sometimes null?

One sample cannot show that. Feed in a document that includes the null case, or widen the type by hand afterwards.

Which draft does it target?

A widely supported draft that current validators accept. If your tooling pins a specific version, check the $schema line matches before using it.

Last updated

Powered by maratool