I am struggling with using Angular 5 HttpClient to send a post request because I am having trouble casting an object to nested JSON. For instance, I have the following class:
export class Team {
members: Person[];
constructor(members: Person[]) {
this.members = members;
}
}
export class Person {
name: string;
gender: string;
...
constructor(...) { ... }
}
The desired JSON body structure should look like this:
{
"members" : [
{
"name" : someone01,
"gender" : ...,
...
},
{
"name" : someone02,
"gender" : ...,
...
},
...
]
}
Can someone please advise me on how to achieve this? Thank you in advance.