How to parse a JSON object to a TypeScript Object

后端 未结 8 725
谎友^
谎友^ 2020-11-30 05:21

I am currently trying to convert my received JSON Object into a TypeScript class with the same attributes and I cannot get it to work. What am I doing wrong?

8条回答
  •  星月不相逢
    2020-11-30 06:00

    let employee = JSON.parse(employeeString);
    

    Remember: Strong typings is compile time only since javascript doesn't support it.

提交回复
热议问题