At the entrance comes xml

<myObject> <sendingTimes> <sendingTime> <sendingTimeAlias>1</sendingTimeAlias> </sendingTime> <sendingTime> <sendingTimeAlias>2</sendingTimeAlias> </sendingTime> <sendingTime> <sendingTimeAlias>3</sendingTimeAlias> </sendingTime> </sendingTimes> </myObject> 

Java class

 @XmlRootElement(name = "myObject") @XmlAccessorType(XmlAccessType.FIELD) public class MyObj implements Serializable { private static final long serialVersionUID = 1L; @XmlElementWrapper(name = "sendingTimes") @XmlElement(name = "sendingTime") private List<SendingTime> sendingTimes = new ArrayList<>(); //другие переменные конструктор и гетеры/сеттеры 

entity class

 @XmlRootElement(name = "sendingTime") @XmlAccessorType(XmlAccessType.FIELD) public class SendingTime implements Serializable { private static final long serialVersionUID = 1L; private String sendingTimeAlias; геттеры сеттеры конструктор 

Further, when the xml is entered and successfully read, I need to submit sendingTimes as a string.

I do it by this method

 String SendingTimesXml = xmlMapper.writeValueAsString(MyObj.getSendingTimes()); 

the result is a tin:

 <ArrayList><item><sendingTimeAlias>1</sendingTimeAlias> ... 2, ... 3 ...</item></ArrayList> 

    0