我有一个json对象如下
[
{
"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"
}
]
我需要使用 Unique BrandList 制作一个 json 对象,如下划线所示。
[{"Nike"}, {"Fila"},{"Levis"}, {"Fasttrack"},{"Nokia"}, {"HTC"},{"Samsung"}, {"pepe jeans"}, {"peter england"},{"red tape"}]
我可以得到下面的数据而不是上面的格式,并且品牌必须是唯一的。
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} ]