Looking to convert an object into an array of objects in order to use the angular2 *ngFor directive. Here is the initial JSON object:
Object {CountryID: 87944818, ISO2: "do", ISO3: "u", Name: "aliqua sit magna tempor"}
The desired format is an array of objects like this:
[Object]
0: Object
CountryID: 87944818
ISO2: "do"
ISO3: "u"
Name: "aliqua sit magna tempor"
I attempted to achieve this using Object.keys and map but did not get the expected output. Here is what I tried:
let keys:any[] = [];
for (let key in value) {
console.log(key);
keys.push({key: value[key]});
}
console.log(keys);
The 'value' variable represents the object that needs to be converted.