ToolBuddy
In Browser

JSON to TypeScript

Infer TypeScript interfaces from a JSON sample. Nested objects become named interfaces, and keys missing from some objects in an array are optional. Conversion stays in the tab.

Runs in your browser. Nothing is uploaded.

0 characters · 0 lines

0 characters · 0 lines

About this tool

Infer TypeScript from a JSON sample. Objects become named interfaces. Keys missing from some objects in an array are optional. Values that disagree become a union, including null.

How to use: paste JSON, copy the interfaces. A root array of objects is exported as type Root. Empty objects become Record<string, unknown> and empty arrays become unknown[]. This is a starting point, not enums, generics, or a JSON Schema compiler.

Example: {"id":1,"name":"Ada","address":{"city":"London"}} yields interface Root and interface Address. Related: JSON to JSON Schema for a schema draft, JSON to Code for JS, Python, or PHP literals.

Related Convert tools