Hi Chirag,

Please note that json encoded Avro is NOT the same as plain json. It's a
special json dialect that is generally not compatible with regular json
data.

Sad news: there exists no json parser that yields Avro records. Json simply
lacks the context information that Avro union parsing needs.

Kind regard,
Oscar

-- 
Oscar Westra van Holthe - Kind <os...@westravanholthe.nl>

Op ma 5 dec. 2022 12:47 schreef Chirag Dewan <chirag.dewa...@gmail.com>:

> Hello,
>
> My system is receiving JSON data serialized from JSON schemas. I am trying
> to represent the *minProperties *and *maxProperties *types in JSON schema
> in AVRO using Union types. But the problem is, AVRO JSON decoder expect the
> Union branch to be present in data and it searches the union type by fully
> qualified name i.e. namespace and type name.
>
> Unfortunately, this is not how my data is encoded.
>
> My input JSON is encoded like this:
>
> {"Request": {
> ....
>   }
> }
>
> And I represent it as:
>
> {
>     "name": "Schemas",
>     "namespace": "com.sample",
>     "type": ["null", {
>         "type": "record"
>         "name": "Request"
>         ...
>
>     }
> }
>
> So AVRO JSON decoder expects the following:
>
> {"com.sample.Request": {
> ....
>   }
> }
>
> One way I thought I could solve this is by using blank namespaces. But that 
> messes my Java class generation in default package.
>
>
> Any way around this? Any help is appreciated.
>
> Thank you.
>
>
>
>

Reply via email to