An API i call gives out a result like so:
{
"name1" : "value1",
"name2" : "value2",
"name3" : "value3",
"name4" : "value4",
}
I want to change convert that to
[
{"name1" : "value1"},
{"name2" : "value2"},
{"name3" : "value3"},
{"name4" : "value4"},
[
I tried to use
Object.keys(result).forEach(function(key) {
console.log(key, result[key]);
let item = key;
policyStatusList.push(
new Object({
item: result[key]
})
);
});
but it ended up as
[
{"item" : "value1"},
{"item" : "value2"},
{"item" : "value3"},
{"item" : "value4"},
[
Any suggestions?