-1
我从API后端检索非常大的数据。我需要将JSON对象转换为打字稿对象。我试过做JSON.parse(JSON.stringify(result));
,但不幸的是,由此创建的模型没有包含任何方法。我怎样才能将这个JSON对象转换为打字稿类?你能否建议我可以使用的任何npm插件?将JSON对象转换为Typescript类
result => {
this.app = JSON.parse(JSON.stringify(result));
resolve(true);
}
我有一个巨大的模型,其中涉及到嵌套的对象和多态性。我希望我可以使用一个npm插件来帮助我
的可能的复制[如何初始化一个JSON对象打字稿对象(https://stackoverflow.com/questions/22885995/how-do-i- initialize-a-typescript-object-with-a-json-object) – jcalz
[TypeScript JSON string to class]的可能重复(https://stackoverflow.com/questions/40171620/typescript-json-string-to-class) – jcalz