I have a generic class:

public class MsgServerData<T> {
...
    public T content;
...
}


Previously the concrete implementation was MsgServerData<Invitation<String>> 
and it worked fine, I was able to deserialize the object.

Now, I had to change the Invitation to have two parameters: 
MsgServerData<Invitation<VCard,String>>. 

And now it fails with the following exception:


com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize 
instance of java.lang.String out of START_OBJECT token 
at [Source: N/A; line: -1, column: -1] (through reference chain: 
co.tinode.tinodesdk.model.MsgServerData["content"]) 


i.e. it thinks the 'content' should be a String, not an Invitation.


Here is how I construct the data type for Jackson:


JavaType typeOfInvitation = 
    jacksonTypeFactory.constructParametricType(Invitation.class, 
        jacksonTypeFactory.constructType(VCard.class), 
        jacksonTypeFactory.constructType(String.class)));
JavaType typeOfDataPacket = 
    jacksonTypeFactory.constructParametricType(MsgServerData.class, 
typeOfInvitation);

Where is my mistake?

Thanks!



-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to