How to parse a JSON object to a TypeScript Object

后端 未结 8 730
谎友^
谎友^ 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 05:55

    if it is coming from server as object you can do 
    

    this.service.subscribe(data:any) keep any type on data it will solve the issue

提交回复
热议问题