Tuttilo

JSON to TypeScript - Generate TS Interfaces from JSON Online

Convert JSON data to TypeScript interfaces instantly. Automatically infers string, number, boolean, array, and object types.

Paste a JSON object or array into the input field and the tool generates a TypeScript interface matching its structure. Primitive types (string, number, boolean) are inferred from values. Objects become nested interfaces, and arrays are typed as Type[]. Optional properties are marked with ? when the field might be missing. You can customize the root interface name and choose between interface or type alias syntax. The generated TypeScript is properly formatted with indentation and ready to copy into your project. All type inference runs in your browser.

Developers integrating third-party APIs paste sample responses to generate type definitions without manually transcribing nested structures. Teams migrating JavaScript projects to TypeScript convert configuration objects to interfaces for type safety. Backend engineers share API response formats with frontend teams by providing TypeScript interfaces generated from real data. Developers working with JSON-heavy applications (like Firebase or Contentful) bootstrap type files to enable autocomplete and catch errors.

Sample data must be representative—if a field can be null or a different type, include multiple examples or manually edit the output. Arrays containing mixed types (like [1, "two", true]) generate union types; consider if the API actually allows this or if your sample is flawed. Optional fields (present in some responses, absent in others) require manual annotation—the tool can't infer optionality from a single example. Use const assertions for literal types when you want "success" rather than string. Always verify generated interfaces against actual API documentation.

All processing happens directly in your browser. Your files never leave your device — no server uploads, no cloud storage, no data retention. The tool works offline once loaded, requires no registration, and is completely free with no usage limits.

Frequently Asked Questions

How are types inferred?

Strings become string, numbers become number, booleans become boolean. Objects generate new interfaces, arrays use element types.

Does it handle nested objects?

Yes, nested objects generate separate named interfaces with proper type references.

What about arrays of objects?

Arrays of objects generate a typed array using the first element to infer the interface structure.