users@jersey.java.net

[Jersey] Re: Json and polymorphism

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 25 Jan 2011 14:44:11 +0100

On Jan 25, 2011, at 11:16 AM, Grenzinger Yannick wrote:

> 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.plugin.system.issuetabpanels%3Aall-tabpanel
>
> What is your current status in Jersey ? (you’re using Jackson true ?)
>

In Jersey 1.5 it is version 1.5.5.

I suspect you can probably override the version to 1.7 without issue.

We should upgrade in 1.6-SNAPSHOT. Jakub?

Paul.