Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

JSON Schema to TypeScript Converter

Paste a JSON Schema (draft-07 or 2020-12) and get TypeScript interfaces — required and optional properties, enums as union types, oneOf/anyOf as unions, allOf as intersections, $ref definitions as named types and descriptions as JSDoc comments.

Mis à jour le
Declare as

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : JSON Schema to TypeScript

  1. Paste your JSON Schema — or an OpenAPI components.schemas object — on the left.
  2. Set the root type name and whether to use interface or type.
  3. The TypeScript types update as you type; definitions under $defs or definitions become their own named types.
  4. Copy the code into a .ts or .d.ts file.

How JSON Schema maps to TypeScript

JSON SchemaTypeScript
"type": "string" / number, integer / boolean / nullstring / number / boolean / null
properties + requiredinterface with prop and optional prop?
enum, constliteral union: "draft" | "published"
items, prefixItemsT[], tuples [A, B]
additionalProperties (schema)index signature [key: string]: T
oneOf / anyOf / allOfA | B / A | B / A & B
$ref: "#/$defs/User"the named type User
"type": ["string", "null"]string | null

Validation-only keywords such as minLength, pattern or format have no TypeScript equivalent; they are added to the JSDoc comment when JSDoc is on. External $ref URLs are typed as unknown.

Starting from example data instead of a schema? Use JSON to TypeScript. To check data against a schema, use the JSON Schema Validator.

Aussi recherché comme : json schema to ts, generate typescript from json schema, json schema interface, json-schema-to-typescript online, openapi schema to typescript, json schema types, json schema converter.

Outils complémentaires : JSON Schema to TypeScript

  • JSON to JSON Schema — Paste one or more JSON examples and get a JSON Schema that describes them: nested objects, arrays of objects merged into one item schema, required fields (keys present in every example), detected formats like email, date-time, URI and UUID, optional enums, and draft 2020-12 or draft-07 output.
  • JSON vers les types — Collez une réponse API et obtenez des modèles prêts à l'emploi dans 8 langages : TypeScript, Python (dataclass, TypedDict ou Pydantic), Go, Java, C#, Kotlin, Swift et Rust.
  • Formateur JSON — Collez votre code JSON pour le formater, le compresser ou le valider.
  • OpenAPI / Swagger Validator — Paste an API specification to check it against the official OpenAPI schema, catch broken references and inconsistent path parameters, and see every endpoint at a glance.

Questions fréquentes

How do I convert JSON Schema to TypeScript?
Paste the schema on the left; TypeScript interfaces appear on the right. Definitions in $defs or definitions become named types that $ref points to.
Which JSON Schema versions are supported?
Draft-04 to draft-07 and 2019-09/2020-12 keywords: properties, required, enum, const, items, prefixItems, additionalProperties, oneOf, anyOf, allOf, $ref, $defs and definitions.
Can I use it for OpenAPI schemas?
Yes — paste a single schema, or the whole components.schemas object to get one type per schema. #/components/schemas/ references are resolved.
Is my schema uploaded?
No. Conversion runs entirely in your browser.
Puis-je installer JSON Schema to TypeScript en tant qu’application web et l’utiliser hors ligne ?
Oui. JSON Schema to TypeScript est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires