Upon successfully fetching JSON data, parsing it, and pushing it to an array, the current result is:
[object, object]
The desired transformation involves converting each object into the following data model:
import { ItemModel } from './item.model';
export class TodolistModel {
name: string;
items: Array<ItemModel> = [];
}
An attempt was made:
parsedTodolists.forEach(parsedTodolist => {
let loadChecklist = Object.assign(new TodolistModel(), parsedTodolist); }
However, the outcome of this process appears as follows:
TodolistModel {0: Object, 1: Object, items: Array(0)}
The ultimate goal is to achieve the following structure:
[TodolistModel, TodolistModel]
Your assistance in accomplishing this would be greatly appreciated. Thank you!