I'm trying to deserialize a Java object from JSON, and I usually have no problems, except when the JSON string contains the following field (serialized by JAXB on server side)
"portsOrdered":{"entry":[{"key":"1022016","value":0}]}
I'm trying to bind it to a Map
inside my Item
object that contains a Map<String, Integer>
private field. I do the deserialization with the Spring code
ResponseEntity<Item[]> responseEntity = restTemplate.exchange(context.getBaseUrl(), HttpMethod.POST,
new HttpEntity<Query>(query, context.getDefaultHeaders()), Item[].class);
but I always get the Exception
org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of int out of START_ARRAY token
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of int out of START_ARRAY token
Any ideas on how to solve this?