【发布时间】:2014-02-01 04:37:47
【问题描述】:
如何从我拥有的 JSON 输出中删除 type。我有一个包含 REST 服务输出的类/bean。我正在使用 jersey-media-moxy 进行转换。
服务
@Resource
public interface MyBeanResource
{
@GET
@Path("/example")
@Produces( MediaType.APPLICATION_JSON )
public Bean getBean();
}
豆子
@XmlRootElement
class Bean
{
String a;
}
我想添加一些功能(用于使用构造函数初始化 bean)
class BeanImpl extends Bean
{
BeanImpl(OtherClass c)
{
a = c.toString()
}
}
输出的 JSON 是:
{type:"beanImpl", a:"somevalue"}
我不想在我的 JSON 中使用 type。我该如何配置?
【问题讨论】:
标签: java json jersey marshalling moxy