我想用个人详细信息丰富订单的收集。
假设我已经(示例在 json 中):
[
{
"orderId": 123,
"quantity": 5,
"buyerId": "84aa820f-2301-4d01-8c4c-2b71204da7dd"
},
{
"orderId": 124,
"quantity": 5,
"buyerId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d"
}
]
现在我想提取所有买家标识符以点击其他消息端点,所以我会得到结果:
[
{
"personId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"name": "Johny",
"surname": "Bravo"
},
{
"personId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"name": "Felica",
"surname": "Good"
}
]
有了这些信息,我需要用人物详细信息来丰富每个对象,所以最终结果将是这样的:
[
{
"orderId": 123,
"quantity": 5,
"buyerId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"buyer": {
"personId": "84aa820f-2301-4d01-8c4c-2b71204da7dd",
"name": "Johny",
"surname": "Bravo"
}
},
{
"orderId": 124,
"quantity": 5,
"buyerId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"buyer": {
"personId": "7158a748-dfd0-47e5-b620-e8ca4d3ac84d",
"name": "Felica",
"surname": "Good"
}
}
]
使用浓缩器可以实现这一目标吗?