首页 > 编程知识 正文

java字符串转json,json转对象

时间:2023-05-05 19:18:16 阅读:224765 作者:21

@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面试达人”,收看更多精彩内容

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。