NiFi convert json to csv using ConvertRecord

佐手、 提交于 2019-12-09 04:49:27

The steps provided below will help you in getting this done.:

  • Connect your source processor which generates/outputs the JSON files to ConvertRecord.
  • Configure ConvertRecord and set 'Record Reader' to use JsonTreeReader controller service and 'Record Writer' to use CSVRecordSetWriter controller service
  • Configure both the controller services and set Schema Registry property to use AvroSchemaRegistry
  • Configure AvroSchemaRegistry. Go to 'Properties' tab and click the + button which lets you add a dynamic property.
  • Give some property name (ex: mySchema) and for the value, give the Avro schema expected for your input JSON. (You can use InferAvroSchema processor to generate Avro schema for your JSON)
  • Configure both JsonTreeReader and CsvRecordSetWriter and set the 'Schema Name' property to the name provided above, in this case, mySchema.
  • Connect the relationships of ConvertRecord to downstream processors according to your need.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!