java - Jackson: Marshall and Unmarshall Array to XML -
i want marshall , unmarshall following xml:
<body> <type>getline</type> <data> <linemessage> <email>test</email> <agents> <agents> <email>a</email> <version>1</version> </agents> <agents> <email>b</email> <version>2</version> </agents> <agents> <email>c</email> <version>3</version> </agents> </agents> </linemessage> </data> </body>
body pojo:
public class body { private string type; private string data; }
linemessage pojo: (i put inside string data of body)
public class linemessage { private string email; private arraylist<agentinfo> agents; }
but when unmarshal body , data, i last object of array (agents):
<linemessage> <email>test</email> <agents> <agents> <email>c</email> <version>3</version> </agents> </agents> </linemessage>
i want know how can work array using jackson. thanks.
edit: resolved putting jackson flag @jacksonxmlcdata in data string: @jacksonxmlcdata available since 2.5. https://github.com/fasterxml/jackson-dataformat-xml:
Comments
Post a Comment