Closed mensinda closed 1 year ago
Workaround: Use ObjectMapper.setPropertyNamingStrategy()
with something like this:
public class XmlNamingStrategy extends PropertyNamingStrategies.NamingBase {
@Override
public String translate(String propertyName) {
return propertyName.replace("$", "_-_DOLLAR_-_");
}
}
Still, this should work out of the box, or the XML generation should fail and not produce a broken XML string.
I think that providing a default PropertyNamingStrategy
that is configured for XmlMapper
(but may be replaced) is probably a good way to improve things. I thought we already had name mangling for POJO properties but turns out name mangling is currently only used for Type Ids of polymorphic type handling.
So this is something worth adding to 2.14 -- I hope to get it, or, if you or anyone else has time, could help with getting a PR merged.
Example:
jackson version: 2.13.2