You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Giancarlo Frison <gf...@chelab.com> on 2011/07/28 11:06:20 UTC
JsonEncoder and unions
Hi all,
Question 1:
I need to set fields as nullable. In order to accomplish this, I registered
such fields as union(string,null).
when I encode objects through json encoder the output generated is
"field":{"string":"blablabla"}
Is there a config property or a way to encode as "field":"blablabla"?
question 2:
Is it possible to configure JsonDecoder for reading unordered field input?
thanks,
--
Giancarlo Frison
http://gfrison.com
Re: JsonEncoder and unions
Posted by Doug Cutting <cu...@apache.org>.
On 07/28/2011 02:06 AM, Giancarlo Frison wrote:
> I need to set fields as nullable. In order to accomplish this, I
> registered such fields as union(string,null).
> when I encode objects through json encoder the output generated is
> "field":{"string":"blablabla"}
> Is there a config property or a way to encode as "field":"blablabla"?
This is not currently possible. The specification defines this:
http://avro.apache.org/docs/1.5.1/spec.html#json_encoding
> question 2:
>
> Is it possible to configure JsonDecoder for reading unordered field input?
That is an unfortunate aspect of the Java implementation of the JsonDecoder.
http://s.apache.org/E2N
Doug