Jackson Java to JSON object mapper modifies field's name

Viewed 1542

Using Jackson to convert a Java object to JSON

ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
jsonMessage = mapper.writeValueAsString(object);

the result is that the field "participants" (which is part of the object instance)

participants    Arrays$ArrayList<E> 

gets renamed to "participantsList"

participantsList":[{"userId":"c1f9c"}]

i.e. "List" is appended to the field name. I went through the Jackson documentation but haven't found a way to prevent this from happening. Is this possible? Testing the above code in a standalone project does not cause the same result (i.e. no renaming takes place). Why is Jackson behaving like this? Unfortunately, the object is third party and I cannot change it.

Using Jackson version 2.3.3 (same behaviour verified with 2.9.0).

2 Answers
Related