Article

Why a JSON Schema Generated From One Example Is a Draft, Not a Final Spec

Published 2026-09-14

Inferring structure from an example is inherently limited

Generating a schema from one sample JSON object is fast because it just needs to look at what's actually there: each field's data type, and the fact that every field present in the sample gets marked as required. The catch is baked into that description — the schema only knows what it saw in that one example.

Where this goes wrong in practice

If a field is sometimes a number and sometimes null in your real data, but your sample only showed a number, the generated schema will incorrectly require it to always be a number. If an optional field simply wasn't present in your sample, it gets marked required anyway, since the generator has no way to know it's actually optional.

Why this is still genuinely useful

Despite that limitation, generating a starting schema from a real example is usually much faster than writing one from scratch, since most of a schema's structure — the field names, the nesting, the basic types — is usually correct on the first pass. Treat the output as a solid first draft to review and adjust, not a final specification to trust blindly.

Try it yourself

Our JSON Schema Generator infers a JSON Schema from any sample JSON object or array, entirely in your browser.

Ready to try it yourself?
Open the JSON Schema Generator →