0

我有案例:流中的内容始终是 json 格式,而json中的数据总是在变化(kyes 和 values)。这可以将此流内容转换为 csv吗?

请注意,json 中的键总是在变化的。

非常感谢,

4

1 回答 1

0

为了实现这个用例,我们需要首先为每个json 记录动态生成 avro 模式,然后转换为 AVRO,最后将 AVRO 转换为 CSV

流动: 在此处输入图像描述

1.SplitJson //split the array of json records into individual records

2.InferAvroSchema //infer the avro schema based on Json record and store in attribute

3.ConvertJSONToAvro //convert each json record into Avro data file

4.ConvertRecord //read the avro data file dynamically and convert into CSV format

5.MergeContent (or) MergeRecord processor //to merge the splitted flowfiles into one flowfile based on defragment strategy.

保存xml 并上传到您的 nifi 实例并根据您的要求进行更改。

于 2018-09-26T22:00:26.127 回答