How do I use xStream to output Java Objects with List properties?
Posted
by Zachary Spencer
on Stack Overflow
See other posts from Stack Overflow
or by Zachary Spencer
Published on 2010-04-19T18:01:00Z
Indexed on
2010/04/19
18:03 UTC
Read the original article
Hit count: 319
Hello,
I am trying to output some Java objects as JSON, they have List properties which I want to be formatted as { "People" : [ { "Name" : "Bob" } , { "Name" : "Jim" } ] }
However, I cannot figure out how to do this with XStream. It always outputs as { "Person" : { "Name" : "Bob" }, "Person" : { "Name" : "Bob" }
Is there a way to fix this? I've put together some sample code with a unit test in github if you need something more concrete to play with: http://gist.github.com/371358
Thanks!
© Stack Overflow or respective owner