Announcement Announcement Module
Collapse
No announcement yet.
Exception while receiving List<Object> in Json (Andorid platform) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception while receiving List<Object> in Json (Andorid platform)

    Below is my rest service,

    1) @ResponseBody UserDetails getUserDetails(); and my UserDetails class is
    @XmlRootElement
    class UserDetails {
    String userName;
    // getters and setters;
    }
    I can able to retrieve the UserDetails in android without any issues.

    Now I have modified my rest service to
    @ResponseBody UserCollections getUserDetails(); and my UserCollections class is

    @XmlRootElement
    class UserCollections {
    List<UserDetails> userDetailsList;
    //getters and setters;
    }

    Now i am getting the following exception

    Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.List out of START_OBJECT token
    at [Source: org.apache.http.conn.EofSensorInputStream@40679600 ; line: 1, column: 2] (through reference chain: com.application.user.models.UserCollections ["userDetailsList"])
    at org.codehaus.jackson.map.deser.StdDeserializationC ontext.mappingException(StdDeserializationContext. java:198)
    at org.codehaus.jackson.map.deser.CollectionDeseriali zer.handleNonArray(CollectionDeserializer.java:149 )
    at org.codehaus.jackson.map.deser.CollectionDeseriali zer.deserialize(CollectionDeserializer.java:107)
    at org.codehaus.jackson.map.deser.CollectionDeseriali zer.deserialize(CollectionDeserializer.java:97)



    Any idea to solve this error ?

    I am using MappingJacksonHttpMessageConverter for conversion.

    thanks,
    Arun
Working...
X