users@jersey.java.net

[Jersey] Re: Deserializing nested objects

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 24 Nov 2011 09:07:28 -0800

2011/11/24 António Mota <amsmota_at_gmail.com>:
...
> when trying to deserialize I got the following:
>
> Problem deserializing property 'coordinates' (expected type: [simple type,
> class BoxCoordinates]; actual type: java.util.LinkedHashMap), problem: Can
> not set BoxCoordinates field Image.coordinates to java.util.LinkedHashMap
> (through reference chain: Image["coordinates"])

This is usually a clear indication that type information is being lost
somewhere due to Java's type erasure.

So, instead of trying to bind to, say, BoxCoordinates, declared type
is passed as Object; and JSON Object structure is mapped to
LinkedHashMap in those cases (it is an Object, and usually most
logical match).

To know why this happens it would be necessary to see definition of
Image class, to know what exactly is happening.

-+ Tatu +-