JOLT 规范将如何通过以下输入实现预期结果?
How will the JOLT spec look to achieve desired result with the following input?
我在将 JSON 有效负载转换为所需文档时遇到问题。
我有以下输入:
{
"events": [
{
"recipientId": "r0001"
},
{
"recipientId": "r0002"
}
],
"networkResponseTime": 1234
}
期望的输出:
{
"events": [
{
"recipientIds": "r0001",
"networkResponseTime": 1234"
},
{
"recipientIds": "r0002",
"networkResponseTime": 1234"
}
]
}
此示例的 JOLT 规范如何?
到目前为止我有这样的事情:
[{
"operation": "shift",
"spec": {
"events": {
"*": {
"recipientId": "events[&1].recipientIds"
}
}
}
}]
规格
[{
"operation": "shift",
"spec": {
"events": {
"*": {
"recipientId": "events[&1].recipientIds",
//
// go back up to the root of the tree, and then
// come back down the key "networkResponseTime", and
// send it's value to "events[&1].networkResponseTime"
"@(2,networkResponseTime)": "events[&1].networkResponseTime"
}
}
}
}]
我在将 JSON 有效负载转换为所需文档时遇到问题。
我有以下输入:
{
"events": [
{
"recipientId": "r0001"
},
{
"recipientId": "r0002"
}
],
"networkResponseTime": 1234
}
期望的输出:
{
"events": [
{
"recipientIds": "r0001",
"networkResponseTime": 1234"
},
{
"recipientIds": "r0002",
"networkResponseTime": 1234"
}
]
}
此示例的 JOLT 规范如何?
到目前为止我有这样的事情:
[{
"operation": "shift",
"spec": {
"events": {
"*": {
"recipientId": "events[&1].recipientIds"
}
}
}
}]
规格
[{
"operation": "shift",
"spec": {
"events": {
"*": {
"recipientId": "events[&1].recipientIds",
//
// go back up to the root of the tree, and then
// come back down the key "networkResponseTime", and
// send it's value to "events[&1].networkResponseTime"
"@(2,networkResponseTime)": "events[&1].networkResponseTime"
}
}
}
}]