我正在使用spring MVC来实现返回Object Response
类JAVA Reponse
@XmlRootElement(name="response")
public class Response {
private String request ;
private List<ListResponse> responses;
}
类JAVA ListResponse
@XmlRootElement(name="response")
public class ListResponse {
private String param ;
private List<Param> values;
}
类JAVA Param
public class Param {
private String ID;
private String VALUE;
private String LIBELLE;
}
Web服务的结果就是这个JSON:
{
"request": "DEP",
"response": {
"param": "DEP",
"values": [
{
"ID": 1000016,
"LIBELLE": "AIN",
"VALUE": "010"
}
]
}
}
但这对我不利,我希望Reponse为List
,就像这样
{
"request":"DEP",
"response":[
{
"param":"DEP",
"values":[
{
"ID":1000016,
"LIBELLE":"AIN",
"VALUE":"010"
}
]
}
]
}
那么,对此有什么解决方法吗?