Jolt 变换规范输入
Jolt transform specification input
我有以下输入 json:
{
"tags": {
"event": "observation",
"source": "hunter"
}
}
输出 JSON 应如下所示:
{
"tags" : [ "event:observation", "source:hunter" ]
}
任何人都可以就如何为上述内容建立适当的颠簸规范提供任何指导吗?
非常感谢您的帮助^_^
你可以使用这个规范
[
{ // combine each key-value pair under within common arrays
"operation": "shift",
"spec": {
"tags": {
"*": {
"$": "&2_&1",
"@": "&2_&1"
}
}
}
},
{ // concatenate key-value pairs by colon characters
"operation": "modify-overwrite-beta",
"spec": {
"*": "=join(':',@(1,&))"
}
},
{
"operation": "shift",
"spec": { // make array key common("tags") for all arrays
// through use of _ seperator and * wildcard
"*_*": "&(0,1)"
}
}
]
站点 http://jolt-demo.appspot.com/ 上的 演示 是
我有以下输入 json:
{
"tags": {
"event": "observation",
"source": "hunter"
}
}
输出 JSON 应如下所示:
{
"tags" : [ "event:observation", "source:hunter" ]
}
任何人都可以就如何为上述内容建立适当的颠簸规范提供任何指导吗?
非常感谢您的帮助^_^
你可以使用这个规范
[
{ // combine each key-value pair under within common arrays
"operation": "shift",
"spec": {
"tags": {
"*": {
"$": "&2_&1",
"@": "&2_&1"
}
}
}
},
{ // concatenate key-value pairs by colon characters
"operation": "modify-overwrite-beta",
"spec": {
"*": "=join(':',@(1,&))"
}
},
{
"operation": "shift",
"spec": { // make array key common("tags") for all arrays
// through use of _ seperator and * wildcard
"*_*": "&(0,1)"
}
}
]
站点 http://jolt-demo.appspot.com/ 上的 演示 是