Convert a JSON sample into a TypeScript interface, free — including nested objects and arrays.
This tool runs entirely as JavaScript in your browser. the JSON sample you paste is never transmitted over the network to this site's server or any third party, and is never written to a cookie, to browser storage, or to any log — there is nothing on our end to breach, subpoena, or accidentally leak, because it was never received in the first place. Closing or refreshing this tab clears it completely.
This describes only what this specific tool does with what you type into it. It doesn't cover the rest of this site — see the Privacy Policy for how analytics and advertising cookies are handled elsewhere.
Paste a real JSON sample — an API response, a config file, anything — and get a matching TypeScript interface, with nested objects becoming their own separate interfaces and arrays correctly typed by their contents.
This works by inspecting your actual sample's values, not by asking you to describe the shape yourself: a string becomes string, a number becomes number, a nested object gets its own generated interface (named after the key it was found under), and an array is typed by what's actually inside it — a single consistent type where every element matches, or a union type when they don't.
Since this only sees the one sample you paste, it can't know whether a field is ever optional, nullable in other responses, or could hold a different type under different conditions — treat the output as a solid starting point to refine with real `?` optional markers and broader types where your actual data varies more than a single example shows.
Yes — a nested object generates its own separate interface, named after the key it was found under, and is referenced by that name in the parent interface — the same way you’d structure it by hand.
It generates a union type covering everything actually found in the array — for example (string | number)[] if the array genuinely mixes strings and numbers.
No — since this only sees the one sample you paste, it has no way to know which fields are sometimes missing in other real responses. Add `?` manually to fields you know can be absent.
No — the sample is parsed and converted entirely in your browser. Nothing is sent to a server.