我想在Nifi中使用Jolt处理器实现以下JSON转换
输入JSON
{
"topLevel": {
"secondLevelA": {
"thirdLevelA": [
{
"norsemen": "huntinSouth",
"value": "AAA"
},
{
"norsemen": "huntinNorth",
"value": "BBB"
}
]
},
"secondLevelB": {
"thirdLevelB": [
{
"norsemen": "huntinNorth",
"oddCode": "AAA301"
},
{
"norsemen": "huntinNorth",
"oddCode": "BBB701"
},
{
"norsemen": "huntinWest",
"oddCode": "AAA701"
}
]
}
}
}
输出JSON
{
"NAME": [
{
"norsemen": "huntinSouth",
"value": "AAA",
"refValue": []
},
{
"norsemen": "huntinNorth",
"value": "BBB",
"refValue": [
{
"oddCode": [
"BBB701"
]
}
]
}
]
}
我想测试 secondLevelA.thirdLevelA.norsemen 和 secondLevelB.thirdLevelB.norsemen 的值之间的匹配。如果找到一个或多个匹配项,则与匹配的北欧门派相同的集合中包含的 secondLevelB.thirdLevelB.oddCode 的所有值都将放置在与相应匹配的北欧门户相同的集合中的输出中。
有没有办法使用现有的Jolt操作来做到这一点?
答案 0 :(得分:0)
似乎你有一些无法用jolt覆盖的非声明性逻辑。
Jolt:
股票转型是:
shift : copy data from the input tree and put it the output tree
default : apply default values to the tree
remove : remove data from the tree
sort : sort the Map key values alphabetically ( for debugging and human readability )
cardinality : "fix" the cardinality of input data. Eg, the "urls" element is usually a List, but if there is only one, then it is a String
我在这里看不到if/then/else
因此,我认为仅jolt