我们将 XStream 用于我们的宁静服务。但是,对于具有相同值的字段,Xstream 为我们提供了不同的结果。假设它是 Book 对象:
public class Book {
public String name "myName";
public List <String> authors = new List <String> ();
public String subject "mySubject";
public Book() {}
}
为此的json是:
{
"Book": {
"name": "myName",
"authors": "",
"subject": ["mySubject"]
}
}
但是,如果我将作者添加到集合中,我会得到不同的结果。
{
"Book": {
"name": "myName",
"authors": ["author1", "author2", "author3"],
"subject": "mySubject"
}
}
有没有人遇到这个问题并知道解决方案?