Esta página aún no está traducida al español, así que la mostramos en inglés.

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.

Actualizado el
Declare as

Tus datos nunca salen de tu ordenador. Todo se procesa localmente en tu navegador.

Cómo usar: 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.

También se busca como: 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.

Herramientas que combinan con: 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.
  • De JSON a tipos — Pega una respuesta de la API y obtén modelos listos para usar en 8 lenguajes: TypeScript, Python (dataclass, TypedDict o Pydantic), Go, Java, C#, Kotlin, Swift y Rust.
  • Formateador JSON — Pega el código JSON para formatearlo, minimizarlo o validarlo.
  • 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.

Preguntas frecuentes

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.
¿Puedo instalar JSON Schema to TypeScript como aplicación web y utilizarla sin conexión?
Sí. JSON Schema to TypeScript es una aplicación web instalable (PWA): se instala desde el navegador, no se descarga desde una tienda de aplicaciones. Haz clic en «Instalar aplicación» en la parte superior de esta página en Chrome o Edge (Windows, macOS, Linux, ChromeOS) o, en Android, utiliza «Compartir» → «Añadir a la pantalla de inicio» en iPhone y iPad, o «Archivo» → «Añadir al Dock» en Safari 17+ en un Mac. A continuación, se abrirá en su propia ventana con su propio icono y, como se ejecuta íntegramente en tu navegador, seguirá funcionando sin conexión. Firefox en el ordenador de sobremesa no permite instalar aplicaciones web. Cómo funciona la instalación.

Herramientas relacionadas