JSON Schema Generator

Paste a JSON sample, get back a JSON Schema (draft 2020-12) that validates it. Useful for adding schema validation to an API where you have example responses but no schema, or for sanity-checking that a payload matches an expected shape.

How to use the JSON Schema Generator

Paste a JSON sample (or array of samples — the tool merges shapes). Pick the draft (2020-12 is current; draft-07 for older tooling like AJV without v8 plugins). "All required" assumes every field in the sample must be present in valid documents — uncheck if your sample might have optional fields you haven't included.

About JSON Schema

JSON Schema is the standard way to describe and validate JSON structure. A schema lets your API reject malformed requests with specific error messages, and lets downstream tools (TypeScript generators, OpenAPI docs, code generators) understand the shape of your data.

Draft 2020-12 is the current spec; draft-07 is older but widely supported. The big practical difference is how arrays of mixed types are described and how $dynamicRef works. For most uses, the generated schemas are interchangeable.