JSON Schema Generator from JSON Sample
NOUVEAUJSON Schema generator that infers draft-07 or 2020-12 schemas from a JSON sample: types, required keys, nested objects and string formats. Free, in-browser.
Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.
Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.
A key is required only when it appears in every object of the sample. Mixed values become a type list or anyOf.
Exemples rapides
Des entrées typiques et les résultats produits par cet outil.
Présentation
A JSON Schema generator saves you from writing validation schemas by hand. Paste a representative JSON document and get a schema that describes its types, nested objects, array items and required keys, ready for Ajv, OpenAPI components or form generators.
Array items are merged into one item schema, so a key that is missing from some items is left out of "required", and mixed values become a type list such as ["string", "null"] or an anyOf. Whole numbers are typed as integer. Optional format detection adds email, date-time, date, uri and uuid when every sample value matches. You can target draft-07 or 2020-12 and forbid additional properties.
Everything runs in your browser, so sample data is never uploaded.
Pourquoi utiliser cet outil ?
- Bootstrap a schema in seconds
- Required keys inferred from real samples
- Detects email, date-time, uri and uuid
- Draft-07 or 2020-12 output
- Private: runs locally
Fonctionnalités
Nested schemas
Objects and arrays are described recursively with properties and items.
Required keys
Keys present in every sample object go into "required".
Format detection
Adds format for email, date-time, date, uri and uuid strings.
Strict mode
Untick "Allow additional properties" to add additionalProperties: false.
Two drafts
Switch the $schema URI between draft-07 and 2020-12.
Copy or download
Copy the schema or save it as schema.json.
Mode d'emploi
Paste a JSON sample
Use a realistic document; arrays with several items give better results.
Pick the draft
Choose draft-07 or 2020-12 and optionally set a Title.
Tune options
Toggle Detect formats, Allow additional properties and Require every key.
Copy the schema
Click Copy or Download and review it before using it in production.