Jolt Json 转换:使用属性值过滤键
Jolt Json transformation: Using value of an attribute to filter on a key
我正在尝试使用 Jolt 转换来转换 Json,在此寻找一些输入。
我正在尝试过滤作为另一个属性值的键。这是我的输入和预期输出
{
"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"
}
我正在查看的输出是
{
"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.Can 请有人帮忙吗?
[ // 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"
}
}
}
}
}
]
我正在尝试使用 Jolt 转换来转换 Json,在此寻找一些输入。 我正在尝试过滤作为另一个属性值的键。这是我的输入和预期输出
{
"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"
}
我正在查看的输出是
{
"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.Can 请有人帮忙吗?
[ // 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"
}
}
}
}
}
]