I am developing an Angular4 project and using ta-json for serializing models.
Backend Api are responding something like this :
   {
      "id":1,
      "teams":[
         {
            "id":1,
            "name":"TeamName",
            "members":[
               {
                  "id":1000,
                  "team_id":1
               },
               {
                  "id":1001,
                  "team_id":1
               }
            ]
         }
      ]
   }
team.ts
import {JsonObject, JsonProperty, JsonType} from "ta-json";
import {Player} from './player';
@JsonObject()
export class Team {
    @JsonProperty()
    id: number;
    @JsonProperty()
    @JsonType(Player)
    players: Player[];
}
player.ts
import {JsonObject, JsonProperty, JsonType} from "ta-json";
@JsonObject()
export class Player {
    @JsonProperty()
    id: number;
    @JsonProperty()
    // @JsonType(Team)
    team: Team;
}
I want to convert team_id (presents in api response) to Team object by it's id.
Any help would be appreciated.
Thanks
 
    