[英]Jolt Json transformation: Using value of an attribute to filter on a key
我正在嘗試使用 Jolt 轉換在此處尋找一些輸入來轉換 Json。 我正在嘗試過濾作為另一個屬性值的鍵。 這是我的輸入和預期 output
{
"pid": "p1@gmail.com",
"eventType": "new",
"details": {
"participants": {
"automationqaus@gmail.com": {
"id": "automationqaus@gmail.com",
"type": "Customer"
},
"p1@gmail.com": {
"id": "p1@gmail.com",
"name": "participantAgent1",
"joinTime": 1617634021103,
"type":"Agent"
},
"p2@gmail.com": {
"id": "p2@gmail.com",
"name": "participantAgent1",
"joinTime": 1617634022303,
"type":"Agent"
}
}
},
"interactionId": "c5804d49-961d-11eb-9650-7fb32f44d8a5"
}
我正在看的 Output 是
{
"pid": "p1@gmail.com",
"name": "participantAgent1",
"joinTime": 1617634021103,
"type":"Agent"
}
我嘗試過的規格是
[
{
"operation": "shift",
"spec": {
"participants": {
"@(2,pid)": {
"@(3,pid)": "pid",
"pType": "type",
"name": "name",
"joinTime":"joinTime"
}
}
}
}
]
但我沒有預料到 output。 我也嘗試了其他一些組合,但未能得到正確的 output。有人可以幫忙嗎?
[ // converting the matching value as the key to the value of the details.
{
"operation": "shift",
"spec": {
"details": "@(1,pid)"
}
},
{
"operation": "shift",
"spec": {
"*": {
"participants": {
"&1": { // matching with the target converted key
"id": "pid",
"type": "type",
"name": "name",
"joinTime": "joinTime"
}
}
}
}
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.