开发者

Using @JsonTypeInfo annotation for generic object lists

开发者 https://www.devze.com 2023-01-10 12:59 出处:网络
I am trying to serialize and de-serialize (with Json and ObjectMapper) an polymorphic list of Objects that have the following annotation on the base class:

I am trying to serialize and de-serialize (with Json and ObjectMapper) an polymorphic list of Objects that have the following annotation on the base class:

@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")

When I write the object itself it does include the polymorphic property class in to its properties list, and when I 开发者_开发百科write a list of these objects it does not include any information on the classes in this list.

Does someone know what is wrong or what to configure ?


I was using the wrong version 1.5.2 which has that bug open. They have it fixed in 1.5.4

0

精彩评论

暂无评论...
验证码 换一张
取 消