Hi all,
I am new to software engineering field and i'm a student.
I'm try building a simple data flow which can read csv file from the local
system, post it in the HTTP as a JSON message format.
For that i'm using GetFile, convertCSVTOAvro, ConvertAvroToJSON and
PostHTTP respectively. The problem i'm facing trouble when writing avro
schema.
my csv file contain data as
1234,701,temperature,4.504342,20.44345,2.3,4.50345
i write the avro schema as like
{
"type" :"record",
"name" : "event",
"fields" : [
{"name":"metaData_timestamp","type" : "long"},
{"name":"metaData_sensorId","type" : "int"},
{"name":"metaData_sensorName","type" : "string"},
{"name":"correlationData_longitude","type" : "double"},
{"name":"correlationData_latitude","type" : "double"},
{"name":"humidity","type" : "float"},
{"name":"sensorValue","type" : "double"}
]
}
and the format of json i need is
{
"event": {
"metaData": {
"timestamp": 4354643,
"sensorId": 701,
"sensorName": "temperature"
},
"correlationData": {
"longitude": 4.504343,
"latitude": 20.44345
},
"payloadData": {
"humidity": 2.3,
"sensorValue": 4.504343
}
}
}
I google to sorted out the problem, but i couldn't.
Or suggest me how to create json message in Nifi.
Thank you in advance.
Best regards,
Janu Thevan.