JSON to TypeScript
Infer TypeScript interfaces or type aliases from one or many JSON samples. Multi-sample merging, optional-when-missing detection, string-literal unions, ISO date / UUID format hints, readonly + JSDoc options, hierarchical type naming, and code-style presets.
JSON input
Paste one or more JSON samples. Multiple samples are merged - keys missing in any sample become optional.
Generated TypeScript
1 type - 20 lines
interface Root {
id: number;
login: string;
avatar_url: string;
type: string;
site_admin: boolean;
name: string;
company: string;
blog: string;
location: string;
email: null;
bio: string;
twitter_username: null;
public_repos: number;
public_gists: number;
followers: number;
following: number;
created_at: string;
updated_at: string;
}Configuration
Shape the generator's output to match your codebase conventions.
Root type name
Output style
Quote style
Indentation
Max union members
Trailing semicolons
Add a trailing semicolon to every property declaration.
Readonly properties
Prefix every property with readonly.
Use unknown over any
Use unknown for unmappable values (recommended).
Inline primitive arrays
Emit T[] instead of Array<T> for primitive element types.
Sort keys
Alphabetize property order across every interface.
String literal unions
When a field only sees a small set of values across samples, emit a literal union.
Detect known formats
Recognize ISO dates, UUIDs, emails and URLs and surface them as comments.
Emit JSDoc comments
Annotate each property with an @example block from the first sample.