JSON to TypeScript
NEWConvert JSON data into TypeScript interfaces instantly.
Frequently asked questions
Does it check every element of an array to build the type, or just one?
Just the first element — whatever shape or type element 0 has determines the type for the whole array, so a JSON array mixing different object shapes or value types has those differences silently ignored.
How does it name interfaces for nested objects?
A nested object's interface is just its property name, capitalized — not prefixed by the parent's name. That means two different nested keys with the same name in different parts of your JSON (like user.address and company.address) both generate an interface called Address, and since TypeScript merges same-named interfaces, the final output can end up combining fields from both instead of keeping them distinct. Arrays of objects don't have this problem, since those interfaces are prefixed with the parent name.
What happens to a key that isn't a valid identifier, like one with a space?
It gets quoted instead of used bare — a key like "first name" is rendered as "first name": string; rather than being rejected or auto-converted to camelCase.