0

I have a pojo with a field that contains JSON array and jaxb wraps this data as a string is there any way to overcome this problem without umarshalling and marshalling the json content and without using a custom message writer? or ca i define a custom writer in a field with some annotation?

@XmlRootElement
public class TestPojo{
   String name;
   String list;
   @XmlElement(name="name")    
   public String getName(){
       return this.name;
   }
   @XmlElement(name="data")
   public String getData(){
       return this.data;
   }

}

data is an existing json array in string format

so i want to expose it as JSON

{
 "name":"My Name",
 "data":[{"el":"aname"}, {"el":"aname2"}]
}

Instead of

    "data":"[{"el":"aname"}, {"el":"aname2"}]"
4

0 回答 0