JSON to TypeScript Converter Free

Paste a sample JSON payload and get TypeScript types for it. Nested objects get their own interfaces, arrays are merged into one element type, and keys that don't appear in every item become optional.

🧾 JSON sample

Declaration style

🟦 TypeScript

🟦Types appear here.

Types are inferred from the sample you give: keys missing from some array items become optional, mixed values become unions. A single sample can't show every shape the API returns — review the result.

Built by Pyalm

Pyalm builds custom software, APIs and integrations for businesses in India and the UAE. We made these developer tools for our own team — use them free, and talk to us when you need something built.

Pyalm serviceCustom softwareInternal tools, portals and business systems built around how your team actually works — not the other way round.See custom software Pyalm serviceBusiness automationConnect your apps and remove copy-paste work — approvals, reports, document flows and notifications on autopilot.See business automation

From a sample to a type

Typing a large API response by hand is slow and error-prone. The converter reads your sample, names an interface for every nested object, and merges array elements: if some items have a discount field and others don't, the field becomes optional; if a value is sometimes a string and sometimes null, you get a union.

Treat the output as a starting point

A type inferred from one sample can only describe what that sample shows. A field that is always a number in your example might be null in production, or a string enum might have more values than you saw. Use the generated types to get going, then tighten them against the API's schema or documentation.

Related

More free tools you might need

🧾

JSON Formatter & ValidatorFree

Format, validate, minify and syntax-highlight JSON — with exact error line and column.

🔁

CSV ⇄ JSON ConverterFree

Convert CSV to JSON and JSON to CSV with delimiter detection, type inference and flattening.

🔀

JSON Compare (Diff)Free

Compare two JSON documents and see every added, removed and changed value by path.

🛰️

API Tester (REST Client)Free

Send GET, POST, PUT, PATCH and DELETE requests from your browser and inspect the response.

Browse all free tools

FAQ

Frequently asked questions

Interface or type — which should I use?

Both work for object shapes. Interfaces can be extended and merged, and give clearer error messages; type aliases are required for unions and mapped types. Pick whichever your codebase already uses.

How are property names like 'issued-at' handled?

Names that aren't valid identifiers are quoted: "issued-at": string;. Type names are converted to PascalCase from the property name.

Does it handle empty arrays?

An empty array has no element to infer from, so its type is never[]. Add a representative item to the sample.

Need a tool built for your own workflow?

Pyalm builds custom software, APIs and integrations for businesses in India and the UAE. We made these developer tools for our own team — use them free, and talk to us when you need something built.

See custom software