Générateur de Schéma JSON
Générez un Schéma JSON (Brouillon 2020-12) à partir d'un document JSON exemple. Détection de format intelligente.
Réponse rapide: Générateur de Schéma JSON : générez un schéma JSON (brouillon 2020-12) à partir d’un exemple de document JSON. Détection intelligente du format. Fonctionne entièrement dans votre navigateur, gratuitement et sans inscription.
Dernière mise à jour
Bon à savoir
A schema generated from a single example is a starting point, not a finished contract. Because the tool sees one document, it marks every property as required and pins each type exactly. That is usually too strict for real APIs, where fields come and go and some values are legitimately null. Expect to prune the required array and widen types before you ship the schema to production validation.
The format detection is genuinely useful: strings that look like ISO 8601 timestamps, email addresses, or URIs get the matching format keyword, which downstream validators such as Ajv can enforce. Draft 2020-12 is the output dialect, so it plays nicely with modern tooling, but note that some format checks are opt-in and must be enabled in your validator's configuration.
If your data varies across records, generate a schema from a few representative samples and merge them by taking the union of properties and the intersection of required keys. For editing the resulting document, pretty-printing it, or converting between formats, pair this with the JSON formatter. Reserve heavyweight schema-inference libraries for when you need enums, pattern constraints, or multi-file references.
Questions fréquentes
- Pourquoi mon schéma est-il trop strict ?
- Nous inférons à partir d'un seul exemple, donc chaque champ est requis et les types sont exacts. Assouplissez le schéma en retirant des clés du tableau <code>required</code> ou en utilisant <code>type: ["string", "null"]</code> pour les champs nullable.
- Quel draft est la sortie ?
- JSON Schema Draft 2020-12, la dernière version stable. Il est compatible avec tous les validateurs modernes (Ajv, JSON Schema Validator, etc.).
- Va-t-il détecter des e-mails, des URLs et des dates ?
- Oui - les valeurs de chaîne correspondant aux motifs d'e-mail, de date-heure (ISO 8601) et d'URL obtiennent l'annotation <code>format</code> correspondante.
- Mes fichiers JSON sont-ils téléchargés ?
- Non - l'inférence s'effectue entièrement dans votre navigateur.
- Comment inférer à partir de plusieurs échantillons ?
- Générez un schéma à partir de chaque échantillon, puis fusionnez à la main (ou utilisez un outil comme <code>quicktype</code>) - prendre l'union des propriétés et l'intersection des clés requises donne un schéma qui convient à tous les échantillons.