I am trying to use XStream to quickly serialize objects in Xml or JSON for wire and deserialization. I want the XML / JSON to be simple / clean.
Everything seems to be fine, I added a few aliases, but now I got into the problem, this code:
println(new XStream.toXML(List(1,2,3)))
creates this XML:
<scala.coloncolon serialization="custom">
<unserializable-parents/>
<scala.coloncolon>
<int>1</int>
<int>2</int>
<int>3</int>
<scala.ListSerializeEnd/>
</scala.coloncolon>
</scala.coloncolon>
I think it happens that the Scala List class has its own serialization ... I wonder if there is a way to override this? I would prefer:
<list>
<int>1</int>
<int>2</int>
<int>3</int>
</list>
source
share