[
https://issues.apache.org/jira/browse/AVRO-1618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14240501#comment-14240501
]
Ryan Blue commented on AVRO-1618:
---------------------------------
I'm sorry to be so confusing, I was definitely mixing up the reader and
encoder. I think you're right and I'm talking about a DatumReader for JSON.
This wouldn't work like DatumReader and BinaryDecoder because those make
assumptions about one another. I'm thinking that the JsonDecoder returns a
single JSON record (however it is parsed) at a time and the JsonDatumReader
does the work to ensure it looks like it would coming from the DatumReader,
meaning that the union representation is fixed along with any other necessary
changes (fill in defaults?). With this picture in my head, what you've built
here is fairly close to the JsonDatumReader, just without logic to do reconcile
the read and write schemas. (We can add that later)
I haven't worked with the JSON format much in java, so I don't know what the
usual format is. It's not too hard to add something to the spec, so maybe we
should fix it.
> Allow user to "clean up" unions into more conventional dicts in json encoding
> -----------------------------------------------------------------------------
>
> Key: AVRO-1618
> URL: https://issues.apache.org/jira/browse/AVRO-1618
> Project: Avro
> Issue Type: Improvement
> Components: python
> Affects Versions: 1.7.7
> Reporter: Aaron Kimball
> Assignee: Aaron Kimball
> Attachments: avro-1618.1.patch
>
>
> In Avro's JSON encoding, unions are implemented in a tagged fashion; walking
> through this data structure is somewhat cumbersome. It would be good to have
> a way of "decoding" this tagged-union data structure into a more conventional
> dict where the union element is directly present without the tag.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)