Loading the interactive tool… It runs in your browser — if it doesn't appear, enable JavaScript.
Paste a JSON response and get TypeScript interfaces for it. Nested objects become their own named types, plural keys are singularised so `posts` gives you `Post[]`, and identical shapes are de-duplicated under one name rather than emitting Profile, Profile2 and Profile3 for the same object.
Objects inside an array are merged into a single shape, with any key missing from some elements marked optional. Generating a separate type per array element would be technically accurate and completely unusable — this is the behaviour you actually want from a sample.
Frequently asked questions
Why are some fields marked optional?
Because they appear in some elements of an array but not others. If your sample has two posts and only one has a `pinned` field, the generated type marks it `pinned?: boolean`, which is the correct reading of that evidence.
What happens to null values?
By default a null becomes the type `null`, which is honest about what the sample showed but rarely useful. Turn on "treat null as optional" to get an optional `unknown` instead. Either way, a sample can't tell you whether a field is nullable or just happened to be null once — check the API's documentation.
Should I trust generated types?
Treat them as a fast first draft, not a contract. A sample only shows what was present in that one response: fields that are optional but absent won't appear at all, an empty array gives `unknown[]`, and a number that's always been an integer might be a float. Generated types are a starting point you then correct against the real schema.
interface or type?
Both are offered. Interfaces can be extended and merged, which is useful for extending third-party types; type aliases handle unions and mapped types that interfaces can't. For plain object shapes like these, the difference rarely matters — pick whichever your codebase already uses.