I was working on a restful api which should return a json data.
My service is like this:
@Path("tfs/projectRegStatus")
public class ProjectRegStatusService {
@GET
@Path("/QA")
@Produces(MediaType.APPLICATION_JSON)
public ProjectRegStatusVO getProjectRegStatusQA(){
return ProjectRegStatusModule.getInstance().getProjectRegResult("QA").produceNumber();
}
And the entity ProjectRegStatusVO is like:
@XmlRootElement
public class ProjectRegStatusVO {
private String name;
private int colorValue;
private List<ProjectRegStatusVO> children;
}
And my question is that when we only have one child, JSON Data should be like:
{
"name": "SpecPool Risk",
"colorValue": 48,
"children": [
{
"name": "Hedge Sheet",
"colorValue": 48
}
]
}
This must have []
in child list, even if it only has one child.
But my result does not have []
in child list.
Could you guys help?
Aucun commentaire:
Enregistrer un commentaire