You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Yanna elina <ya...@gmail.com> on 2019/09/16 11:56:27 UTC
it's still there is not workaround on 1.9.1 to handle missing field
in json ?
HI guys ,
I need to convert data received from API-REST to Avro GenericRecord.
The schema is defined from the outside I do not want to use POJO java
I do not want to create schema on the fly either because I want to be able
to control the type before the base injection
I try all cases with the default / union values nothing works
Example with :
public static String JSON_SAMPLE_INT_ONLY = "{\n" +
" \"myInt\": 12345\n" +
"}";
with this :
{
"name": "test",
"type": "record",
"namespace": "hello.test",
"fields": [
{
"name": "myInt",
"type": "int",
"default": 0
},
{
"name": "myString",
"type": "string",
"default": ""
}
]
}
*i got Expected string. Got END_OBJECT*
{
"name": "test",
"type": "record",
"namespace": "hello.test",
"fields": [
{
"name": "myInt",
"type": "int",
"default": 0
},
{
"name": "myString",
"type": [
"null",
"string"
],
"default": null
}
]
}
*i got Expected start-union. Got END_OBJECT*
*any suggestion ? *
*thanks *