【发布时间】:2012-06-16 19:55:43
【问题描述】:
我有以下课程....
@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,它使用 Jackson)
我希望 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}}]
有没有办法强制它使用第一种输出格式(没有列出名称)?
感谢您的帮助, 梅森
【问题讨论】:
标签: json jax-rs jackson resteasy