JSON Schema to TypeScript
Paste a JSON Schema document (Draft 4 through 2020-12) and get TypeScript interfaces back.
Handles $defs, $ref,
allOf, anyOf,
oneOf, enum, and string
format annotations. Runs entirely in your browser.
What this converter handles
- • All primitive types (
string, number, integer, boolean, null) - •
enum→ literal union - •
const→ literal - •
$refwith#/$defs/Xor#/definitions/X - •
anyOf,oneOf→ union - •
allOf→ intersection - •
arraywithitemsand prefix-items tuples - •
additionalPropertiestyped objects - • String
formatvalues map to branded string types
Privacy
The schema you paste is parsed by a tiny client-side script and never uploaded. Disconnect from the internet after the page loads and this tool still works.
For the inverse direction, see TypeScript → JSON Schema.