[ https://issues.apache.org/jira/browse/AVRO-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185858#comment-17185858 ]
Jorge Machado commented on AVRO-1582: ------------------------------------- I think I'm hitting similar things with avro 1.10. {code:java} Exception in thread "main" org.apache.avro.AvroTypeException: Expected long. Got VALUE_STRINGException in thread "main" org.apache.avro.AvroTypeException: Expected long. Got VALUE_STRING at org.apache.avro.io.JsonDecoder.error(JsonDecoder.java:511) at org.apache.avro.io.JsonDecoder.readLong(JsonDecoder.java:177) at org.apache.avro.io.ResolvingDecoder.readLong(ResolvingDecoder.java:169) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:197) at org.apache.avro.specific.SpecificDatumReader.readField(SpecificDatumReader.java:136) at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:247) at org.apache.avro.specific.SpecificDatumReader.readRecord(SpecificDatumReader.java:123) at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumReader.java:179) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:160) at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:153) {code} > Json serialization of nullable fileds and fields with default values > improvement. > --------------------------------------------------------------------------------- > > Key: AVRO-1582 > URL: https://issues.apache.org/jira/browse/AVRO-1582 > Project: Apache Avro > Issue Type: Improvement > Components: java > Affects Versions: 1.8.0 > Reporter: Zoltan Farkas > Priority: Major > Attachments: AVRO-1582-PATCH > > > Currently serializing a nullable field of type union like: > "type" : ["null","some type"] > when serialized as JSON results in: > "field":{"some type":"value"} > when it could be: > "field":"value" > Also fields that equal the the default value can be omitted from the > serialized data. This is possible because the reader will have the writer's > schema and can infer the field values. This reduces the size of the json > messages. -- This message was sent by Atlassian Jira (v8.3.4#803005)