[ 
https://issues.apache.org/jira/browse/AVRO-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424402#comment-17424402
 ] 

Ryan Skraba commented on AVRO-1582:
-----------------------------------

The extra type information in a union is a really common complaint, but there 
are some valid reasons for *not* changing the JSON-encoding spec that need to 
be addressed:

#  People that depend on interoperability between languages and versions will 
be unhappy, and
#  If the expected "shape" of your data as JSON is a priority, and _not 
already_ Avro-style JSON, then the JSON encoder/decoders are not especially 
flexible or configurable.

I don't see this making it into the next major release, but we can definitely 
open the conversation to find a solution or workaround for the two specific 
cases in this JIRA, like the ExtendedJsonEncoders by [~zolyfarkas] -- what if 
we were to include these in the Java API with the disclaimer that they generate 
non-standard, non-interoperable JSON for some custom uses (and are not a new 
encoding)?  Would that be too much of a maintenance burden for the project?

In my personal experience, when I've found myself using Avro JSON encoding 
instead of binary encoding, it's usually for a not-very-good reason...

> Json serialization of nullable fields 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)

Reply via email to