JSON deserialization exception - unable to deserialize java.util.ArrayList instance from START_OBJECT token
Below is my JSON response,
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Unable to deserialize java.util.ArrayList instance from START_OBJECT token to [Source: java.io.PushbackInputStream@bce1d9 ; line: 1, column: 556] (via link chain: com.totalHours ["data"] → com.totalHours ["hourly_totals"])
"totalHours":
{
"hourly_totals":
{
"2013112101":
{
"distance": 1324,
"calories": 90.0120018125,
"steps": 1603,
"active_time": 793,
"inactive_time": 220,
"longest_active_time": 302,
"longest_idle_time": 780
},
"2013112101":
{
"distance": 626,
"calories": 47.0120018125,
"steps": 455,
"active_time": 246,
"inactive_time": 260,
"longest_active_time": 203,
"longest_idle_time": 650
},
... more hours ...
}
I took the pojo class as shown below. I am getting an exception when I try to deserialize my json data.
public class totalHours{
private List<String> hourly_totals;
}
But I don't know if I should take the list because there is no array in the answer. What are the other options for testing.
+3
source to share