Convert JSON data to TypeScript interfaces
- 中
- en
An useful tool to quick convert JSON data to TypeScript interfaces.
All you need to do is to paste the data, click 点我转换, and done!
Sample input:
{
"url": "https://jixun.moe/",
"posts": [
{ "title": "日记", "date": "2016.06.08" },
{ "title": "随笔", "date": "2016.06.09" }
],
"last-update": 1465388410306
}
Sample output:
interface IUnknown {
url: string;
posts: IPost[];
"last-update": number;
}
/* 自动生成的 Interface */
interface IPost {
title: string;
date: string;
}
Generated name may not make much sense, just rename it in your IDE / editor.
For example with Visual Studio Code, move the cursor to the variable name and press F2
to rename.
Link: Json 对象 → TypeScript Interface 在线转换器
TODO: Update English UI for this tool.