JSON to TypeScript Converter

Paste a JSON sample and get TypeScript interfaces, with nested objects hoisted into their own named types.

This free online JSON to TypeScript converter infers a type for every value in your sample — objects become interfaces, arrays infer their element type, and fields that aren't present on every array element are marked optional. No signup required, runs entirely in your browser.

Root interface name

Output style

Arrays of objects are merged into one representative interface. Fields missing from some elements become optional (?); fields with different types across elements become a union.

JSON input
TypeScript output

Frequently asked questions

Paste a sample of your JSON into the input box above. The tool parses it, infers a type for every value, and generates TypeScript interfaces — one for the root object and one for each nested object shape — that update instantly as you edit the input.
Nested objects are not inlined — each one is hoisted into its own named interface (named after its property key, PascalCased) and referenced from its parent. Arrays of objects infer a single representative interface for their elements, merging every element's fields together.
Any field that isn't present on every element becomes optional (marked with ?). If the same field holds different types across elements, the tool generates a union type, such as string | number, instead of guessing a single type.
Yes. The tool infers types only from the sample you paste in, not from a schema. If your real dataset has fields that can hold other types or shapes not present in your sample, review the generated interfaces and adjust them by hand.
No. Everything runs locally with JavaScript in your browser. Nothing is uploaded or stored on a server.