当前位置 : 主页 > 网页制作 > HTTP/TCP >

post发送请求,body格式

来源:互联网 收集:自由互联 发布时间:2021-06-16
1、方法 @RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.POST) public HaiKangSubscribeRsp batchSubscribe(@RequestBody HaiKangSubscribeReq haiKangSubscribeReq) {...} 2、main方法 public static void main(String[] args)

1、方法

@RequestMapping(value = "/VIID/Subscribes", method = RequestMethod.POST)
public HaiKangSubscribeRsp batchSubscribe(@RequestBody HaiKangSubscribeReq haiKangSubscribeReq) {...}

 

2、main方法

public static void main(String[] args) {
HaiKangSubscribeReq req = new HaiKangSubscribeReq();
HaiKangSubscribeList subscribeList = new HaiKangSubscribeList();
List<HaiKangSubscribe> subscribe = Lists.newArrayList(new HaiKangSubscribe());
subscribeList.setSubscribe(subscribe);
req.setSubscribeList(subscribeList);
System.out.println(JSONObject.toJSONString(req));
}

 

3、{"subscribeList":{"subscribe":[{"operateType":0,"subscribeStatus":0}]}}

根据对象 @JsonProperty("SubscribeList")    改名称 subscribeList--》 SubscribeList

网友评论