I have an Avro Schema (org.apache.avro.Schema) and a data object. I want to serialize the object into a JSON string according to the schema. Is there any way to do that?
Thanks in advance!
I have an Avro Schema (org.apache.avro.Schema) and a data object. I want to serialize the object into a JSON string according to the schema. Is there any way to do that?
Thanks in advance!
2
Answers
I found a way to get the fields in the Avro schema and use them as a filter for custom serializer. See https://www.baeldung.com/jackson-serialize-field-custom-criteria
You can use a JsonEncoder: