users@jersey.java.net

[Jersey] Json and polymorphism

From: Grenzinger Yannick <ygrenzinger.prestataire_at_vsc-technologies.com>
Date: Tue, 25 Jan 2011 11:16:07 +0100

Hello,

 

We are trying to do json serialization and deserialization on
polymorphic types with this annotation :

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

The solution advised by Jackson here :

http://wiki.fasterxml.com/JacksonPolymorphicDeserialization

 

But we have always this error :

com.sun.jersey.api.client.ClientHandlerException:
org.codehaus.jackson.map.JsonMappingException: Unexpected token
(END_OBJECT), expected FIELD_NAME: missing property '_at_class' that is to
contain type id (for class com.vsct.rd.emerch.model.filter.Filter)

 

This bug seems to be known and corrected in Jackson 1.7 :

http://jira.codehaus.org/browse/JACKSON-356?page=com.atlassian.jira.plug
in.system.issuetabpanels%3Aall-tabpanel

 

What is your current status in Jersey ? (you're using Jackson true ?)

 

Thanks!

 

Yannick