通过读取json文件,将所有名称存储在一个数组中,并将类型存储在typescript类中的一个数组中,但如何动态构建模型类
这是JSON
"layoutItems": [ {
"type": "string",
"name": "firstname",
"label": "Name",
},
{
"type": "string",
"name": "middlename",
"label": "Middle Name",
},
{
"type": "number",
"name": "age",
"label": "Age",
},
{
"type": "number",
"name": "mobile",
"label": "Mobile",
},
}]
need to build model export class like
export class User{
firstname: string;
middlename: string;
age: number;
mobile: number;
}