I am currently faced with an issue involving data retrieved from an API in JSON format, where the entries are structured as maps with number keys. Due to this structure, I am unable to assign my result to the data structure below due to missing Map methods.
entryContainer = {
entries: {
1: {
title: 'title 1'
},
2: {
title: 'title 2'
}
}
export interface EntryContainer {
entries: Map<number, Entry>;
}
export interface Entry {
title: string;
}
// The current assignment does not work
let result: EntryContainer = entryContainer;
Could anyone suggest a more elegant approach to initializing the Entrycontainer with data obtained in the aforementioned format?