JSON to TypeScript

Turn a JSON sample into TypeScript interfaces or type aliases, with a Zod schema when you want one.

TypeScript
export interface Root {
  id: number;
  name: string;
  joined: string; // ISO 8601 date
  roles: string[];
  profile: Profile;
  posts: Posts[];
}

export interface Profile {
  bio: null;
  links: Links;
}

export interface Links {
  site: string;
}

export interface Posts {
  title: string;
  tags?: string[];
  publishedAt?: string; // ISO 8601 date
  draft?: boolean;
}

4 types: Root, Profile, Links, Posts

More in the yard