Search code examples
javamappingdozer

How to map fields correctly using XmlElement for dozer


I have the following field

@Mapping("greatId")
@XmlElement(name = "great_key")
private String greatKey;

So my getters and setters are getGreatKey(), and setGreatKey(..). Then my JSON do not contain the response with field "great_key". But if i add a getter getGreat_key(), then it returns the fields. I dont want to add those getters. What am i doing wrong ?

I found exact same problem explained in : XmlElement ignored by Jackson during serialization


Solution

  • Pretty sure that you are not using Jackson for serialization. ;) Get rid of the current serialization or make it respect the standard annotations.