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:

  1. the root node named car.
  2. 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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -