java - How to change the xml class name using fasterxml jackson? -
i trying figure out how change root node name using jackson fasterxml.
for example:
public class car { @jsonproperty("engine-type") string enginetype = "v8"; } public class ford extends car { } ford car = new ford(); objectmapper xmlmapper = new xmlmapper(); system.out.println(xmlmapper.writevalueasstring(this));
results in:
<ford><engine-type>v8</engine-type></ford>
this want:
- the root node named car.
- i want car lowercase in xml:
for example:
<car><engine-type>v8</engine-type></car>
thanks
i think find solution here: how deserialize xml annotations using fasterxml why don't use @jacksonxmlrootelement like:
@jacksonxmlrootelement(localname = "car") public class ford extends car { }
Comments
Post a Comment