我是Apache的新手,有以下问题:我想转换一个json文件,如下所示:
{
"Property1": "x1",
"Property2": "Tag_**2ABC**",
"Property3": "x3",
"Property4": "x4"
}至:
{
"**2ABC**_Property1": "x1",
"**2ABC**_Property3": "x3",
"**2ABC**_Property4": "x4"
},它的意思是:从某个属性中获取值来更新所有其他属性。当更新只添加一个字符串时,我可以找到使用JoltTransformer的示例,这些示例运行良好。但就我的情况而言,到目前为止我所做的并不是这样:我使用evaluateJSONPath处理器设置了每个属性。但我只是尝试了很多使用update属性处理器的可能性,但都没有成功。我所有可能的测试都类似于(在UpdateAttribute中):
Property1 --> ${'Property2':substring(4,6)}"_"${'Property1'}使用震动:
[
{"operation": "modify-overwrite-beta",
"spec": {
"Property1": "${'Property2':substring(4,6)}_${'Property1'}"
}
}
]我在这漏掉了什么?提前感谢!
发布于 2017-09-21 23:39:00
我不知道Nifi,但这是你如何在颠簸中做到的。
等级库
[
{
"operation": "shift",
"spec": {
// match Property2
"Property2": {
"Tag_*": { // capture the nasty "**2ABC**" part to reference later
// go back up the tree to the root
"@2": {
// match and ignore Property2
"Property2": null,
//
// match Property* and use it and the captured
// "prefix" to create the output key
// &(2,1) references the Tag_*, and pull off the "**2ABC**" part
"Property*": "&(2,1)_&"
}
}
}
}
}
]https://stackoverflow.com/questions/46339616
复制相似问题