I am currently dealing with a situation where I have nested DTOs as follows:
export class firstDTO {
public data: secondDTO;
}
export class secondDTO{
public data: Map<Color, thirdDTO>;
}
When I receive the JSON data from the backend and try to print it to the console, I am facing difficulties accessing the values inside the Map. I keep encountering undefined errors.
private getJsonData(): void {
this.service.getJSON()
.subscribe((jsonData: firstDTO) => {
this.things = jsonData;
});
}
The way I would ideally like to access a property of Color is by using this syntax:
this.things.data.data.key[0].property
However, I understand that this approach won't work, so I am seeking assistance in resolving this issue.