数据格式如下:
let arr = [
{
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": false
},
{
"id": "2ea2a723-1a6c-4545-92ce-2ef07547642f",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "M",
"skuCode": "11",
"skuName": "可乐1",
"price": 11,
"isShelf": "上架",
"check": false
},
{
"id": "57bc93ad-84de-4737-8ca6-d6abe97eb9ae",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "L",
"skuCode": "12",
"skuName": "雪碧1",
"price": 12,
"isShelf": "上架",
"check": false
},
{
"id": "57bc93ad-84de-4737-8ca6-d6abe97eb9ae",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "L",
"skuCode": "12",
"skuName": "雪碧1",
"price": 12,
"isShelf": "上架",
"check": false
},
{
"id": "2ea2a723-1a6c-4545-92ce-2ef07547642f",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "M",
"skuCode": "11",
"skuName": "可乐1",
"price": 11,
"isShelf": "上架",
"check": false
},
{
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": false
}
]
目前是id是每一条数据的唯一,如何利用id去重
想要去重后的格式:
[
{
"id": "46f7c6ba-b4ca-4843-b5d1-76399d1ac52a",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "S",
"skuCode": "10",
"skuName": "美年达1",
"price": 10,
"isShelf": "上架",
"check": true
},
{
"id": "2ea2a723-1a6c-4545-92ce-2ef07547642f",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "M",
"skuCode": "11",
"skuName": "可乐1",
"price": 11,
"isShelf": "上架",
"check": true
},
{
"id": "57bc93ad-84de-4737-8ca6-d6abe97eb9ae",
"parentId": "a80ff169-d6f6-4752-b980-fd818240410f",
"attributeName1": "颜色",
"attributeValue1": "黄色",
"attributeName2": "尺寸1",
"attributeValue2": "L",
"skuCode": "12",
"skuName": "雪碧1",
"price": 12,
"isShelf": "上架",
"check": true
}
]