JOLT加入不同的属性
JOLT to join different properties
来源JSON:
[
{
"metrics": {
"cost_per_app_install": "0.08",
},
"dimensions": {
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 170011516
}
},
{
"metrics": {
"cost_per_app_install": "12.3",
},
"dimensions": {
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 17013
}
}
]
预计:
[
{
"cost_per_app_install": "0.08",
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 170011516
},
{
"cost_per_app_install": "12.3",
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 17013
}
]
JOLT 规格:
[
{
"operation": "shift",
"spec": {
"*": {
"metrics": "[&1]",
"dimensions": "[&1]"
}
}
}
]
我想将来自 dimensions
和 metrics
属性的数据添加为一个组合记录。但是无法使用我的 JOLT 配置。此配置仅删除 metrics
和 dimensions
命名。可以只用shift
操作吗?
漫游
等索引还需要一步
[
{
"operation": "shift",
"spec": {
"*": {
"*": { "*": "[&2].&" }
}
}
}
]
顺便说一句,不需要明确列出当前情况的 键值 对,对于 "*": "[&1]"
应该是首选而不是 "metrics": "[&1]","dimensions": "[&1]"
当前对,如果是的话。
来源JSON:
[
{
"metrics": {
"cost_per_app_install": "0.08",
},
"dimensions": {
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 170011516
}
},
{
"metrics": {
"cost_per_app_install": "12.3",
},
"dimensions": {
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 17013
}
}
]
预计:
[
{
"cost_per_app_install": "0.08",
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 170011516
},
{
"cost_per_app_install": "12.3",
"stat_time_day": "2021-06-04 00:00:00",
"campaign_id": 17013
}
]
JOLT 规格:
[
{
"operation": "shift",
"spec": {
"*": {
"metrics": "[&1]",
"dimensions": "[&1]"
}
}
}
]
我想将来自 dimensions
和 metrics
属性的数据添加为一个组合记录。但是无法使用我的 JOLT 配置。此配置仅删除 metrics
和 dimensions
命名。可以只用shift
操作吗?
漫游
等索引还需要一步[
{
"operation": "shift",
"spec": {
"*": {
"*": { "*": "[&2].&" }
}
}
}
]
顺便说一句,不需要明确列出当前情况的 键值 对,对于 "*": "[&1]"
应该是首选而不是 "metrics": "[&1]","dimensions": "[&1]"
当前对,如果是的话。