JSON · Converters

JSON → TypeScript

Paste any JSON payload and get clean, ready-to-use TypeScript interfaces. Runs entirely in your browser — nothing is uploaded.

JSON in
TypeScript out

Turn JSON into TypeScript interfaces, instantly

Paste a JSON object or array on the left and KB Cafe walks the structure to produce matching interface declarations on the right. Nested objects become their own named interfaces, arrays are typed by their elements, and mixed primitives collapse into union types like string | number. It all happens in your browser — no request is ever sent, so it is safe to paste API responses or config you would rather not upload.

How type inference works here

Example

Given a coffee record with an origin object and a list of reviews, you get a root interface plus an Origin and Review interface — drop them straight into your .ts file. Click load sample above to try it.

FAQ

Is my JSON sent to a server?

No. The converter is plain JavaScript that runs on this page. Your input never leaves your browser, which is why it works offline once the page has loaded.

Why are some fields marked optional with ??

When an array contains objects that don’t all share the same keys, the keys that are missing from some elements are marked optional. You can also force every field optional with the toggle above.

Does it handle deeply nested JSON?

Yes — nesting is unlimited. Each distinct object shape becomes its own interface, named after the key that holds it.

Related references

Reading an API token alongside your JSON? Try the JWT decoder. Scheduling a job that emits this payload? See the cron generator.