json字符串转成 json对象 json对象转换成java对象
2020-12-13 02:43
阅读:290
标签:cti code 数组 get sar system dep 依赖包 top
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
依赖包
com.alibaba
fastjson
1.2.54
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); }
/**
* json字符串转转换成json数组
*/
String schedules = "";
JSONArray schedulesArray= JSONArray.parseArray(schedules);
JSONObject jostr = null;
for (int sched = 0; sched
//获取json对象
jostr = schedulesArray.getJSONObject(0);
//System.out.println("jostr---" + jostr);
/**
* json对象转换成java对象
*/
BerthStop berthStopDo = (BerthStop) JSONObject.toJavaObject(jostr, BerthStop.class);
json字符串转成 json对象 json对象转换成java对象
标签:cti code 数组 get sar system dep 依赖包 top
原文地址:https://www.cnblogs.com/JonaLin/p/11049865.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:json字符串转成 json对象 json对象转换成java对象
文章链接:http://soscw.com/essay/26146.html
文章标题:json字符串转成 json对象 json对象转换成java对象
文章链接:http://soscw.com/essay/26146.html
评论
亲,登录后才可以留言!