Is it possible to utilize the es6 Map type in an HTTP Response DTO?
Let's consider an Angular 2 request:
public loadFoos(): Observable<FoosWrapper> {
return this.http.get("/api/foo")
.map(res => res.json());
}
Now, take a look at the DTO structure:
export class FoosWrapper{
foos: Map<string, Foo[]>;
}
Upon calling res.json(), I am only receiving a plain object instead of a Map.
I understand that I need to manually convert the data into a Map, but what would be the most efficient approach for achieving this? Should I iterate over the properties?