JSON解析
来源:互联网 发布:大路口车流量数据 编辑:程序博客网 时间:2024/06/06 23:16
String schemeDetail = [{ "fundCode": "000017", "percent": "50" }, { "fundCode": "000022", "percent": "50" }] JSONArray jsonArray = JSONArray.parseArray(schemeDetail); for (Object object : jsonArray) { JSONObject jsonObject = (JSONObject) object; String fundCode = jsonObject.getString("fundCode"); } String otherRatio = [{ "20160921": "100" }, { "20160922": "200" }] JSONArray jsonArray = JSONArray.parseArray(otherRatio); for (Object obj : jsonArray) { JSONObject map = (JSONObject) obj; for (String key : map.keySet()) { String profit = (String) map.get(key) } } String schemeRatio = { "000017": "50", "001351": "50.00", "000022": "50" } JSONObject jsonObject = JSONArray.parseObject(schemeRatio); Set<Map.Entry<String, Object>> set = jsonObject.entrySet(); for (Map.Entry<String, Object> entry : set) { String fundCode = entry.getKey(); String percent = String.valueOf(entry.getValue()); } String schemeRatio = {"000017":"50","001351":"50.00","000022":"50"} JSONObject map = JSONArray.parseObject(schemeRatio); for(String key : map.keySet()){ String percent = (String) map.get(key) }
"data": { "type":"people", "detail":{ "name":"", "sex":"" } }Map<String, Object> data = new HashMap<>();JSONObject jsonObject = new JSONObject();jsonObject.put("name", "Allen");jsonObject.put("sex", "girl");data.put("type", "people");data.put("detail", jsonObject);
0 0
- 【JSON解析】JSON解析
- 解析JSON
- Json解析
- JSON解析
- JSON解析
- json解析
- Json解析
- Json解析
- JSON解析
- Json解析
- Json解析
- JSON解析
- JSON解析
- json 解析
- Json解析
- JSON解析
- json解析
- json 解析
- python paramiko利用sftp上传目录到远程
- jvm调优总结---jvm参数配置
- JFinal+FreeMarker+Tomcat下ajax跨域请求
- Android实现下载图片,视频,APK功能等功能
- MBProgressHUD的基本用法
- JSON解析
- (转) 卷积的意义
- ORA-01775: 同义词的循环链
- 排列的字典序问题
- 列表的height根据内容自适应
- OLAP基础
- CentOS6.5安装scikit-learn
- 中兴营销类校招交流群 564742543
- android 缓存技术lrucache