简体   繁体   English

将数据转换为 JSON

[英]Transform data into JSON

I am consuming in Nifi messages from a Kafka topic.我正在消费来自 Kafka 主题的 Nifi 消息。

enter image description here在此处输入图像描述

Although I want to convert this messages into a Json with the following attributes:虽然我想将此消息转换为具有以下属性的 Json:

datetime, machineID, volt, rotate, pressure, vibration.日期时间、机器ID、伏特、旋转、压力、振动。

How can I do that, I tried several processors and none of those worked.我怎么能做到这一点,我尝试了几个处理器,但没有一个工作。

if you use the ConsumerKafkaRecord processor you can use the Record Reader and the Record Writer so that NiFi can generate a json as you wish.如果您使用ConsumerKafkaRecord处理器,您可以使用 Record Reader 和 Record Writer,以便 NiFi 可以根据需要生成 json。 Nifi Doc Otherwise if you have a csv and want to transform a csv to json you can use ConvertRecord Stack Doc Nifi Doc否则,如果您有 csv 并想将 csv 转换为 json,您可以使用ConvertRecord Stack Doc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM