JSON to TypeScript

Generate a TypeScript interface from a JSON sample.

Input
Output

Usage examples

Quickly scaffolding a type for an API response

Paste in a sample JSON response from your server and get a TypeScript interface draft you can drop straight into your project.

Automatically splitting nested objects into their own interfaces

When your JSON contains another object, it gets its own named interface based on the field name, keeping things tidy.

Marking fields optional when array items differ

When objects in an array don't all share the same fields, they're merged into a single interface with '?' marking fields that aren't present everywhere.

Frequently asked questions

Is my JSON sent to a server?

No. All conversion happens entirely in your browser, and what you enter is never sent to a server.

Can I use the generated code as-is?

It's inferred from a single JSON example, so it may not capture every variation your real data can take. Treat the generated interface as a starting point and adjust it as needed.

Does it recognize date strings as a Date type?

No. JSON has no dedicated date type, so every string is treated as string. If you want it treated as a date, adjust the generated code by hand.

What happens if the same shape of object appears multiple times?

Objects with an identical structure reuse a single interface instead of generating duplicates.