About JSON to TypeScript
A TypeScript interface describes the shape of an object: its property names and their types. This tool walks a sample JSON value and infers string, number, boolean, or null for primitives, creates a named interface for every nested object (named after its key in PascalCase), and types arrays from their items, using a union when items differ. Types come from one sample only, so optional fields and wider unions must be added by hand.
Also known as: JSON to TS, JSON to TypeScript Converter, JSON to TypeScript Interface.
How to use JSON to TypeScript
- Type or paste into the "JSON" box, or press "Use example" to try it with sample data.
- Set "Root interface name" if the defaults do not fit.
- The result appears below and updates as you type.
- Copy the result with the copy button, or download it as a file where that is offered.
Questions about JSON to TypeScript
Why are no properties marked optional?
The generator sees a single sample and cannot know which fields may be absent, so every key present becomes required. If a field can be missing, add a question mark after its name in the generated interface.
Runs in your browser. Page last updated .