import { Serializable } from '../models/interfaces/Serializable'; export class JsonSerializer>{ public fromJSONArray(items: any[], type: { new(): T; }): T[] { if(!items)return new Array(); const objectList: T[] = new Array(); for (let i = 0; i < items.length; i++) { objectList.push(new type().fromJSONObject(items[i])) } return objectList; } public fromJSONObject(item: any, type: { new(): T; }): T { if(!item)return null; return new type().fromJSONObject(item); } }