I have the object coming in from server as shown below :-
[
{
"gender": {
"male": 25,
"female": 22
},
"population": {
"pop_under": -23 ,
"pop_over": 10,
}
}
]
I want to extract the key as nameand value as value for above object which after modification looks like this :-
[
{
gender : [
{
name : "male",
value : 25
},
{
name : "female",
value : 22
}
],
population : [
{
name: "pop_under" ,
value : "-23"
},
{
name: "pop_over" ,
value : "10"
}
]
}
]
How can perform said modification? And is it useful to use lodashpackage for this ?
Thank you very much for your help.