Skip to content

Instantly share code, notes, and snippets.

@sdeleuze
Created October 4, 2012 19:17
Show Gist options
  • Save sdeleuze/3835793 to your computer and use it in GitHub Desktop.
Save sdeleuze/3835793 to your computer and use it in GitHub Desktop.
Jackson 2.1-SNAPSHOT XML serialization of unwrapped list
Hi,
I have done some tests with 2.1.0-SNAPSHOT since on RESThub project (https://github.com/resthub/resthub-spring-stack) we are waiting XML serialization of unwrapped lists for a while.
We use generic SpringMVC controller with Jackson 2.x for serialization.
@RequestMapping(method = RequestMethod.GET, params="page=no")
@ResponseBody
public List<T> findAllNotPaginated() {
return (List<T>)repository.findAll();
}
For JSON we get this normal output :
[{"id":17,"name":"toto"},{"id":18,"name":"toto"}]
For XML we get this bogus output (the same than is 2.0 I think) :
<ArrayList xmlns=""><id>41</id><name>toto</name></ArrayList><zdef1166645736:ArrayList xmlns:zdef1166645736=""><zdef1166645736:id>42</zdef1166645736:id><zdef1166645736:name>toto</zdef1166645736:name></zdef1166645736:ArrayList>
Is there something to do in order to activate Jackson 2.1 XML unwrapped list support, or is it a bug ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment