1

In my C# Confluent Avro consumer after I received a deserialized binary message (specific record or generic record), I would like to convert the message to json text file for test cases in continuous test environment. So I have this codes to convert schemas

var registeredSchema = schemaRegistry.GetLatestSchemaAsync($"{Topic}-value").Result;
Confluent.SchemaRegistry.Schema confluentSchema = registeredSchema.Schema;
Avro.Schema avroSchema = Avro.Schema.Parse(confluentSchema.SchemaString);

Then, I am stuck here because there is no C# JsonEncoder:

DatumWriter<IssuerSchema> userDatumWriter = new SpecificDatumWriter<IssuerSchema>(avroSchema);
userDatumWriter.Write(EncoderFactory.????);

I am looking for way I can encoder the generic record or the specific record into a json file where I can deserialize back to Generic Record, or Specific Record for publisher/simulator.

Thanks

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Edmond Wong
  • 141
  • 1
  • 4

0 Answers0