收到这是对这个问题的后续问题:JSON对象与空成员
sending nested json object using postman
我试图JSON对象发送到使用邮差泽西Web服务。
我这样做是这样的:
泽西方面:
@Path("/testMethod")
@POST
@UnitOfWork
public short testMethod(@NotNull @BeanParam Test test)
{ ... }
测试类是一个简单的类:
public class Test
{
public String field;
public Test()
{
}
}
邮递员方面我送一POST消息的Body设置为raw,内容类型设置为Json(application/json)。身体本身是:
{
"field" : "12"
}
当发送该请求,在接收的参数field
是空......这是为什么?
我什么时候应该接受不BeanParam注释JSON对象什么时候应该使用它? –
检查我编辑的答案。 '@ BeanParam'是一种允许您轻松访问其他请求信息(标题,查询参数等)的机制。 –