I know the classic approach to marshalling or serializing a collection or
array of jaxb annotated objects is to create a wrapper object to hold your
list or array, and return/serialize that.
Is this still the best approach out there that doesn't rely on any api other
than jaxb (resteasy has a custom annotation that handles this, although I
haven't gotten it to work)?
On a related note, even when I do use that wrapper element, i.e.:
@XmlRootElement
public class EmployeeList {
private Collection<Employee> employees;
}
@XmlRootElement
public class Employee {
}
I get the error:
java.lang.IllegalStateException: Invalid JSON namespace:
http://www.w3.org/2001/XMLSchema-instance
org.codehaus.jettison.mapped.MappedNamespaceConvention.getJSONNamespace(MappedNamespaceConvention.java:151)
org.codehaus.jettison.mapped.MappedNamespaceConvention.createAttributeKey(MappedNamespaceConvention.java:139)
org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(MappedXMLStreamWriter.java:90)
Anyone have any thoughts why this is happening or is there in fact a better
approach to this now?
Note: I am marshalling to JSON, which is why you see jettison in the stack
trace.
Thanks!
Justin
--
View this message in context: http://www.nabble.com/marshalling-collections-or-arrays-tp25031838p25031838.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.