I want to convert an array to object to specific object with key value pair.
[
{
"key": "out.of.stock",
"value": "out of stock"
},
{
"key": "buy.now",
"value": "BUY NOW"
},
{
"key": "notify.me",
"value": "You'll receive an email"
},
]
Output Required:
{
labels :{
"out.of.stock" : "out of stock",
"buy.now" : "BUY NOW",
"notify.me": "You'll receive an email"
}
}
I tried using loadash (keyBy) but output is like:
{
"out.of.stock": {
"key": "out.of.stock",
"value": "out of stock"
},
"buy.now":{
"key": "buy.now",
"value": "BUY NOW"
},
"notify.me": {
"key": "notify.me",
"value": "You'll receive an email"
},
}