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

栏目: 后端 · 前端 · 发布时间: 7年前

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

}


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

HTML & XHTML

HTML & XHTML

Chuck Musciano、Bill Kennedy / O'Reilly Media / 2006-10-27 / GBP 39.99

"...lucid, in-depth descriptions of the behavior of every HTML tag on every major browser and platform, plus enough dry humor to make the book a pleasure to read." --Edward Mendelson, PC Magazine "Whe......一起来看看 《HTML & XHTML》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换