Wednesday 24 August 2016

Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

When supplying json object from postman. if Class contain a list object. Provide it as a array [].
ex :
{
    "name" : "raman",
    "employeeId" : 12345,
"orderList" : {"orderId" : 1,"orderName" : "rest json book"}
}
solution :
{
"name" : "raman",
"employeeId" : 12345,
"orderList" : [{"orderId" : 1,"orderName" : "rest json book"}]
}

No comments:

Post a Comment