颠簸变换可删除破折号以及更复杂的内容

时间:2018-09-20 14:07:26

标签: apache-nifi jolt

输入

{
"item" : "some value",
"get"  : :some other value",
"org"{
"animal-type": ["mammal","reptile","bird"],
"animal-name": ["rat","pigeon"],
"some-random": ["one array"]
....
....any number of items with any name can show up here.. 
.... 
....
},
"some_weight" : "yuad asf-do-not-convet"
}

输出

{
"item" : "some value",
"get"  : :some other value",
....
Array of "org"
....
.... any format with "-" converted to "_" AND any representation in such a way that the number of elements in it is a fixed number
.... This one has ultimately to be converted into avro schema and we don't want to update schemas when occasional items appear within "org"
....
"some_weight" : "yuad asf-do-not-convet"
}

到目前为止,我一直在尝试震撼

[
 {
"operation": "shift",
"spec": {
      "org": {
        "*-*-*": "&(0,1)_&(0,2)_&(0,3)",
        "*-*": "&(0,1)_&(0,2)",
        "*": "&"
      },
      "*": "&"
    }
  }
]

这将-替换为_并删除了org,这对我来说完全没问题。但是,我正在努力将名称,动物类型,动物名称,一些随机(这里是三个,但可以是任何数字)转换为键值类型表示形式,这样我就不必继续调整我的Avro模式出现一些我不希望看到的字段。

0 个答案:

没有答案