码迷,mamicode.com
首页 > 编程语言 > 详细

java 字符串转json,json转对象等等...

时间:2016-09-07 20:52:18      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

@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);

}

 

java 字符串转json,json转对象等等...

标签:

原文地址:http://www.cnblogs.com/yangjinwang/p/5850690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!