I have a json Object as below
[
{
"MerchantName": "Fashion and You",
"BrandList": " Nike, Fila",
"MerchantImage": "Fashion-You-medium.jpeg"
},
{
"MerchantName": "Fashion and You",
"BrandList": " Levis, Fasttrack, Fila",
"MerchantImage": "Fashion-You-medium.jpeg"
},
{
"MerchantName": "ebay",
"BrandList": "Nokia,HTC,Samsung",
"MerchantImage": "ebay.jpeg"
},
{
"MerchantName": "amazon",
"BrandList": "Apple,Dell,Samsung",
"MerchantImage": "amazon.jpeg"
},
{
"MerchantName": "amazon",
"BrandList": " pepe jeans, peter england, red tape",
"MerchantImage, Fila": "amazon.jpeg"
}
]
I need to make a json object with Unique BrandList as below in underscore.
[{"Nike"}, {"Fila"},{"Levis"}, {"Fasttrack"},{"Nokia"}, {"HTC"},{"Samsung"}, {"pepe jeans"}, {"peter england"},{"red tape"}]
Can i get the data as below instead of the above format, and the brand must be unique.
brands = [{brand:"Nike",status:false}, {brand:"Fila",status:false}, {brand:"Levis",status:false},{brand:"Fasttrack",status:false}, {brand:"Nokia",status:false},{brand:"HTC",status:false}, {brand:"Samsung",status:false} ]
_.pluck()- look it up in the Underscore docs