I am currently trying to attempt to change the array > object into a usable object for the application. However, i am currently having issues with trying to convert it into something usable as shown in the example below.
Currently;
[
{
"$dek":"first",
"$value":"value_string"
},
{
"$dek":"second",
"$value":"second_value"
},
{
"$dek":"third",
"$value":"third_val"
},
{
"$dek":"fourth",
"$value":true
},
{
"$dek":"fifth",
"$value":"Test One"
},
{
"$dek":"title",
"$value":"CEO"
}
]
Want to convert it to:
{
first:"value_string"
},
{
second:"second_value"
},
{
third:"third_val"
},
{
fourth:true
},
{
fifth:"Test One"
},
{
title:"CEO"
}
Function:
_toArray: function(obj) {
var arr = Object.keys(obj).map(function(k) { return obj[k] });
console.log(arr);
}
It keeps returning an undefined - any reason why?