Hi,

is it possible by design to deserialize JSON with schema having optional
value?
Schema:

{
 "type" : "record",
 "name" : "UserSessionEvent",
 "namespace" : "events",
 "fields" : [ {
   "name" : "username",
   "type" : "string"
 }, {
   "name" : "errorData",
   "type" : [ "null", "string" ],
   "default" : null
 }]}

Value to deserialize:

{"username" : "2271AE67-34DE-4B43-8839-07216C5D10E1"}

I also tried to change order of type, but that changed nothing. I know I
can produce ill-formated JSON which could be deserialized, but that's not
acceptable. AFAIK given JSON with required `username` and optional
`errorData` cannot be deserialized by design. Am I right?

thanks.

Reply via email to