I have a json object response from serve as like below structure, I have to parse the data from this result.
[CGOLD-1: Array(6), CGOLD-2: Array(6), MGOLD-1: Array(6), MGOLD-2: Array(6), MGOLD-3: Array(6), …]
I have tried as like this to check, My type script code,
baserates: Object = {};
oldbaserates: Object = {};
this.liverateservice.setcallback((data)=>{
this.baserates = data;
this.baserates.forEach((item) => {
console.log(item);
//newArray.push(Object.assign({}, item));
});
});
but my console not working this, I have to do clone object as like this
deepClone(oldArray: Object[]) {
let newArray: any = [];
oldArray.forEach((item) => {
newArray.push(Object.assign({}, item));
});
return newArray;
}
Could you please help anyone to process this type of data structure in angular 2.