{
"name" : "test",
"info": [
{
"key1": "test",
"key2": "blaa",
"key3": "yadayada"
},
{
"key4": "test1",
"key5": "blaa1",
"key6": "yadayada1"
}
],
}
I have this class for the deserialization
public class Account{
private String name;
private Map<String,String>[] info;
}
for some reason info
is not getting deserialized... not even with List<Map<String,String>>
its always null, and name
is working
(im using ObjectMapper
)
the code
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.disable( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
results = objectMapper.readValue(responseBody.getEntity().getContent(), Account.class);
Thanks
This is a mixed bag of things wrong.
Account
)name
field is de-serialized, which I imagine implies some accessible setter is actually there but you may not have posted it?info
silently fails to serialize, it's likely because your ObjectMapper
has been configured with DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
as false
- see docs.List<Map<String, String>>
for info
, or keep the Map<String, String>[]
- it's not relevant to your issue.