What is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It describes the structure of your data: which fields are required, what type each field must be, minimum and maximum values for numbers, string patterns, and the structure of nested objects and arrays. It's widely used for API documentation (OpenAPI/Swagger), configuration validation, and code generation.
This generator analyses your JSON sample and infers a schema based on the types it finds. It cannot infer constraints like minimum/maximum values, string length limits, or enum values โ those must be added manually after generation. Think of the output as a starting scaffold that you then refine.
Draft-07 vs Draft 2020-12
JSON Schema Draft-07 is the most widely supported version and is compatible with the majority of validators, OpenAPI 3.0, and code generation tools. Draft 2020-12 is the latest specification with improved features like $defs (replacing the older definitions), prefixItems for tuple validation, and unevaluatedProperties. Choose based on what your validator or toolchain supports.
Working with the Generated Schema
After generation, you'll commonly want to: remove fields from the required array that are truly optional, add format keywords to string fields (e.g. "format": "email", "format": "date-time"), add enum arrays for fields with fixed allowed values, and add minimum/maximum constraints to numeric fields.