This is my code..
var result = data.map(function(item){
return {
category:item.category,
key:item.key,
value:item.value
}
});
console.log(result);
This is what is getting printed out in console..
Array[4]
0: Object
category: "common"
key: "Food"
value: "food"
1: Object
category: "welcome"
key: "title"
value: "Welcome..."
2: Object
category: "welcome"
key: "app_description"
value: "In this App "
3: Object
category: "welcome"
key: "select_location"
value: "Select Location"
This is what I'm trying to achieve
{
common:{
"Food" : "food"
},
welcome:{
title : Welcome...,
app_description : "In this App",
select_location : "Select Location"
}
}
This is the code I'm trying .but it is not working..
return {
item.category:{
item.key:item.value;
}
Can anyone help me with this? I dont want to use GSON or any other third-party JS..How can i get this done using only core JS?
databefore you start manipulating it? as referenced in your.map()function?