TYPES2JSON.

If you're looking for a tool that can help you convert your TypeScript interfaces and types to JSON, you're in luck! Introducing Types2Json, the online tool that makes it easy to transform your TypeScript code into the popular JSON format.

alt Types2Json

With Types2Json, you can quickly and easily convert your TypeScript code into JSON, making it easy to share your data with others or to integrate it into your web applications.

interface User {
  id: string;
  nickname: string;
  avatar: string;
  level: number;
  premium: boolean;
  phoneNumber: string;
  game: Game
}

interface Game {
  gameId: string;
  title: string;
  kills: number;
  deaths: number;
}

To use Types2Json, simply visit the website and paste your TypeScript code into the provided Editor. Then, hit the "Generate data" button and the tool will automatically transform your code into JSON. You can then copy the resulting JSON and use it in your own projects.

{
  "id": "6_EFHjO'lR",
  "nickname": "yp3x;;aO%N",
  "avatar": "@HI'2%y5#^",
  "level": 95573,
  "premium": true,
  "phoneNumber": "S*MJ=2\"[T.",
  "game": {
    "gameId": "7$Y[)lhI^",
    "title": "#qK]J9PNaM",
    "kills": 55493,
    "deaths": 17458
  }
}

But that's not all! Types2Json also offers a feature that make it even more useful. For example, you can use the tool to convert your TypeScript interfaces and types with some helper types for example you can use an ExtraTypes enum and use ids, userNames, avatar urls, phoneNumber and more.

interface User {
  id: ExtraTypes.ID;
  nickname: ExtraTypes.USER_NAME;
  avatar: ExtraTypes.AVATAR;
  level: number;
  premium: boolean;
  phoneNumber: ExtraTypes.PHONENUMBER;
  game: Game
}

interface Game {
  gameId: ExtraTypes.ID;
  title: string;
  kills: number;
  deaths: number;
}

And the result is similar to this

{
  "id": "dacc0ad6-0819-4eff-9227-7051e78faa08",
  "nickname": "Otilia84",
  "avatar": "https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/945.jpg",
  "level": 10,
  "premium": true,
  "phoneNumber": "+1 390 62 18 47",
  "game": {
    "gameId": "a30d38b4-7b8f-4453-814f-489b7903627c",
    "title": "WHQsf>}oeZ",
    "kills": 71364,
    "deaths": 23984
  }
}

So why not give Types2Json a try? Visit the website today and see for yourself how easy it is to convert your TypeScript interfaces and types to JSON. You won't be disappointed!