0

I want to convert json data to avro. I have used GenerateFlowFile and put dummy json value [{"firstname":"prathik","age":21},{"firstname":"arun","age":22}]. I have then used ConvertRecord processor and set JsonTreeReader and AvroRecordSetWriter with AvroSchemaRegistry which has the following schema:AvroScehma

But i am getting this as my output: Output (Avro Data)

I am new to Apache Nifi. Thanks in Advance.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Set you AvroRecordSetWriter to Embed Avro Schema. Then you should be able to view the converted data (formatted) – Christoph Bauer Aug 25 '20 at 08:54
  • Thanks for your input. I have set the write strategy in AvroRecordSetWriter as Embedded Avro. And i have received the following output  : Objavro.schema€{"type":"record","name":"person","namespace":"nifi","fields":[{"name":"firstname","type":"string"},{"name":"age","type":"int"}]}avro.codecnull¢ÈFB¡-Ž`0„Ûv‚L@prathik*arun,¢ÈFB¡-Ž`0„Ûv‚L@ Again  is red dot. – prathik vijaykumar Aug 25 '20 at 10:43
  • Which NiFi version are you using? Could you provide the configuration for the `JsonTreeReader` and `AvroRecordSetWriter`? – Ben Yaakobi Aug 26 '20 at 08:52

1 Answers1

0

But i am getting this as my output: Output (Avro Data)

That's to be expected. Avro is a binary file format, and what you see is an attempt to make that data viewable in a text format. It's supposed to act like that.

Mike Thomsen
  • 36,828
  • 10
  • 60
  • 83