我想根据字段profileName
、assetLevel1
和assetLevel2
对输入数组对象进行分组。
- 输入:**
{
"product": [
{
"id": "id1",
"entity": "entity1",
"productID": "productID1",
"productName": "productName1",
"unitPrice": "unitPrice1",
"assetLevel1": "Equities",
"assetLevel2": "US Large Cap Equity",
"profileName": "Beginner Level"
},
{
"id": "id3",
"entity": "entity3",
"productID": "productID3",
"productName": "productName3",
"unitPrice": "unitPrice3",
"assetLevel1": "Fixed Income",
"assetLevel2": "Global Aggregate Funds",
"profileName": "Novice Level"
},
{
"id": "id2",
"entity": "entity2",
"productID": "productID2",
"productName": "productName2",
"unitPrice": "unitPrice2",
"assetLevel1": "Equities",
"assetLevel2": "US Large Cap Equity",
"profileName": "Beginner Level"
}
]
}
- 我的当前规格:**
[
{
"operation": "shift",
"spec": {
"product": {
"*": "@profileName.@assetLevel1[]"
}
}
}
]
- 预期产出:**
{
"Beginner Level": {
"Equities": [
{
"US Large Cap Equity": [
{
"assetLevel1": "Equities",
"assetLevel2": "US Large Cap Equity",
"entity": "entity1",
"id": "id1",
"productID": "productID1",
"productName": "productName1",
"profileName": "Beginner Level",
"unitPrice": "unitPrice1"
},
{
"assetLevel1": "Equities",
"assetLevel2": "US Large Cap Equity",
"entity": "entity2",
"id": "id2",
"productID": "productID2",
"productName": "productName2",
"profileName": "Beginner Level",
"unitPrice": "unitPrice2"
}
]
}
]
},
"Novice Level": {
"Fixed Income": [
{
"Global Aggregate Funds": [
{
"assetLevel1": "Fixed Income",
"assetLevel2": "Global Aggregate Funds",
"entity": "entity3",
"id": "id3",
"productID": "productID3",
"productName": "productName3",
"profileName": "Novice Level",
"unitPrice": "unitPrice3"
}
]
}
]
}
}
有人能帮忙吗?
我已经尝试了上述,但无法进行,因为我是一个新手在这方面。
1条答案
按热度按时间wgeznvg71#
可以使用此等级库: