Generate TypeScript types from JSON Schema
The JSON Schema → TypeScript converter turns a JSON Schema object into clean,
idiomatic TypeScript interface definitions. It is built for the LLM era, where
function-calling tool schemas and structured-output formats are expressed in JSON
Schema — generating matching interfaces lets you parse tool arguments and model
responses with full type safety.
How it works
The generator walks the schema recursively. Object types become interfaces;
properties not in the required array become optional (?). Arrays map to
T[], string enums map to string-literal unions, and $ref pointers resolve
against definitions or $defs. anyOf and oneOf render as union types.
Nested anonymous objects get auto-named child interfaces so the output stays
readable. Unknown or unsupported constructs degrade gracefully to unknown.
Tips and notes
If your schema uses $ref, keep the referenced definitions under $defs or
definitions so they resolve. For LLM tool calling, generate the interface for
your function’s parameters schema and type the arguments you receive from the
model. When a field can be several shapes, oneOf produces a discriminated-union
candidate you can refine. The output is plain text — copy it directly into your
project.