So I have an Enum type that implements an Interface, and whilst serialising the JSON turns out fine it can't seem to deserialise it, giving the error "No constructor has been found for type interface." How do I get around this? I put a constructor in the offending Enum subtype but that doesn't seem to help. It doesn't serialise the metadata of that interface field so in the JSON it just looks like a String.
--
You received this message because you are subscribed to the Google Groups "Genson user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+unsubscribe@googlegroups.com.
To post to this group, send email to gen...@googlegroups.com.
Visit this group at https://groups.google.com/group/genson.
To view this discussion on the web visit https://groups.google.com/d/msgid/genson/b79ee56a-4f9d-400e-acc5-eaa3c5cc50c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Seems that you are trying to deserialize to the interface type instead of the concrete enum type. Genson doesn't know what the concrete type of your interface is.You can enable support for polymorphic types though this has some limitations http://owlike.github.io/genson/Documentation/UserGuide/#polymorphic-types
2018-04-09 13:41 GMT-07:00 Peter Davidson <yoursta...@hotmail.com>:
So I have an Enum type that implements an Interface, and whilst serialising the JSON turns out fine it can't seem to deserialise it, giving the error "No constructor has been found for type interface." How do I get around this? I put a constructor in the offending Enum subtype but that doesn't seem to help. It doesn't serialise the metadata of that interface field so in the JSON it just looks like a String.
--
You received this message because you are subscribed to the Google Groups "Genson user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+un...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+unsubscribe@googlegroups.com.
To post to this group, send email to gen...@googlegroups.com.
Visit this group at https://groups.google.com/group/genson.
To view this discussion on the web visit https://groups.google.com/d/msgid/genson/b5ce76f9-68e7-49d7-914c-f792be101282%40googlegroups.com.
Currently no. I started working on a variant that allows to serialize this information for any type (by basically enclosing literals into a json object) but never finished it...Someone had a similar need in the past and here is the solution I was proposing https://stackoverflow.com/questions/33568019/genson-polymorphic-generic-serializationThough if this is the only case where you need that, maybe you should just write a custom Converter?
2018-04-09 14:18 GMT-07:00 Peter Davidson <yoursta...@hotmail.com>:
Is there a way to force Genson to serialise the concrete type in the JSON? It seems like it can do it for objects but not for enums.--
On Monday, April 9, 2018 at 9:48:13 PM UTC+1, eugen wrote:Seems that you are trying to deserialize to the interface type instead of the concrete enum type. Genson doesn't know what the concrete type of your interface is.You can enable support for polymorphic types though this has some limitations http://owlike.github.io/genson/Documentation/UserGuide/#polymorphic-types2018-04-09 13:41 GMT-07:00 Peter Davidson <yoursta...@hotmail.com>:So I have an Enum type that implements an Interface, and whilst serialising the JSON turns out fine it can't seem to deserialise it, giving the error "No constructor has been found for type interface." How do I get around this? I put a constructor in the offending Enum subtype but that doesn't seem to help. It doesn't serialise the metadata of that interface field so in the JSON it just looks like a String.--
You received this message because you are subscribed to the Google Groups "Genson user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+un...@googlegroups.com.
To post to this group, send email to gen...@googlegroups.com.
Visit this group at https://groups.google.com/group/genson.
To view this discussion on the web visit https://groups.google.com/d/msgid/genson/b79ee56a-4f9d-400e-acc5-eaa3c5cc50c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Genson user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+un...@googlegroups.com.
To post to this group, send email to gen...@googlegroups.com.
Visit this group at https://groups.google.com/group/genson.
To unsubscribe from this group and stop receiving emails from it, send an email to genson+unsubscribe@googlegroups.com.
To post to this group, send email to gen...@googlegroups.com.
Visit this group at https://groups.google.com/group/genson.
To view this discussion on the web visit https://groups.google.com/d/msgid/genson/23bd0fa0-0bc0-4ab0-81bd-bcb2c9381be2%40googlegroups.com.