JBOSS 点滴

丰丰的博客

字符串型转换为JSON并获取值

@RequestMapping(value = "updateInvestorApplyAccountNo", method = RequestMethod.POST)
@ResponseBody
public void updateInvestorApplyAccountNo(HttpServletRequest request,
HttpServletResponse response,
@RequestBody String requestBody) {
int num = 0;
String result = "";
//下面是把拿到的json字符串转成 json对象
JSONObject jsStr = JSONObject.parseObject(requestBody); //将字符串{“id”:1}
//int jsID = Integer.parseInt(jsStr.getString("id"));//获取id的值


/** 
* json对象转换成java对象 
*/ 
InvestorApplyModel stud = (InvestorApplyModel) JSONObject.toJavaObject(jsStr,InvestorApplyModel.class);

}

posted on 2018-08-25 15:38 半导体 阅读(157) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: