Hello,
I'm trying to force brackets on lists that contain only one element.
I want something like this:
{"id":"0","industries":[{"id":"0","name":"Technologies"}],"name":"Google Inc."}
But I get:
{"id":"0","industries":{"id":"0","name":"Technologies"},"name":"Google Inc."}
Here is my Entity:
@Entity
@XmlRootElement
public class Company {
private int id;
private String name;
private String description;
@XMLElement(name="industries")
private List<Industry> industryList;
[...]
And finally, my JAXB Context Resolver:
public JAXBContextResolver() throws Exception {
MappedBuilder builder = JSONConfiguration.mapped(); builder.arrays("industries"); builder.rootUnwrapping(true);
this.context = new JSONJAXBContext(builder.build(), Company.class); }