有一个相当复杂的Avro模式(我无法修改)。
尝试在Java中模拟JSON示例:
GenericRecord genericRecord = AvroUtil.jsonToGenericRecord(jsonData, avroSchema);
Run Code Online (Sandbox Code Playgroud)
它不断失败:
Exception in thread "main" org.apache.avro.AvroTypeException: Expected start-union. Got VALUE_STRING
Run Code Online (Sandbox Code Playgroud)
是否存在例如在线工具,它将为任何给定的Avro模式提供JSON数据示例?(以便它可以正确匹配)
尝试模拟JSON数据数小时,但仍然没有成功。
我正在尝试在Avro模式中创建Union字段,并使用它发送相应的JSON消息,但是要使用其中一个字段- null。
https://avro.apache.org/docs/1.8.2/spec.html#Unions
带有相应JSON数据的最简单UNION类型(avro模式)的示例是什么?(尝试举一个不包含null / empty数据和一个包含null / empty数据的示例)。