我正在尝试使用GetFile-> CovertRecord-> PutFile处理器将JSON解析为csv。我的示例JSON看起来像:
[
{
"id": "A1",
"value": "blue",
"num": [5,6,7]
},
{
"id": "B2",
"value": "red",
"num": [1,2,3]
},
{
"id": "C3",
"value": "green",
"num": [4,8,9]
}
]
配置JsonPathReader和CSVRecordSetWriter控制器后,我可以成功地将csv输出解析为JSON,如下所示:
id, value, num
A1, blue, [5, 6, 7]
B2, red, [1, 2, 3]
C3, green, [4, 8, 9]
JsonPathReader配置中的Avro模式如下:
{
"type" : "record",
"namespace" : "data",
"name" : "stuff",
"fields" : [
{"name" : "id" , "type" : "string"},
{"name" : "value" , "type" : "string"},
{"name" : "num" , "type" : {"type" : "array", "items" : "int"}}
]
}
但是我最终需要csv输出看起来像:
id, value, num
A1, blue, 5
A1, blue, 6
A1, blue, 7
B2, red, 1
B2, red, 2
B2, red, 3
C3, green, 4
C3, green, 8
C3, green, 9
使用标准的NiFi处理器和控制器是否可以?我试图避免构建自定义处理器。