我有以下课程....
@XmlType
@XmlRootElement(name = "milestones")
@XmlAccessorType(XmlAccessType.FIELD)
public static class Circle {
public String type = "circle";
public double cx;
public double cy;
public int r;
public String title;
public Integer width;
}
我正在返回一个圈子列表(实际上使用 JaxRS 和 RestEasy,它使用杰克逊)
我希望 Json 输出像
[{"type":"circle","cx":100.0,"cy":100.0,"r":0,"title":"test1","width":2},
{"type":"circle","cx":150.0,"cy":150.0,"r":0,"title":"test2","width":0}]
在我的开发机器上,这就是输出的样子,但在生产中它就像
[{"milestones":{"type":"circle","cx":100,"cy":100,"r":0,"title":"test1","width":2}},
{"milestones":{"type":"circle","cx":150,"cy":150,"r":0,"title":"test2","width":0}}]
有没有办法强制它使用第一种输出格式(没有列出名称)?
谢谢你的帮助,梅森