Java+Jackson+XML: serialize a java object properties as XML elements with same names -
i have java object , serialize xml using jackson library:
public class point { private integer x; private integer y; //getters/setters }
and serialize following format:
<point> <property name="x" value="1" /> <property name="y" value="1" /> </point>
instead of using jacskon:
<point> <x>1</x> <y>1</y> </point>
i not want change point
object properties or structure. there way serialize point
object required format using jackson annotations or custom serializer? if yes how do that?
i using jackson library:
public class serializer { xmlmapper mapper = new xmlmapper(); public void serialize(file file, object object) throws ioexception { mapper.writevalue(file, object); } }
Comments
Post a Comment