阿里巴巴的FastJSON解析JSON例子,超级好用。
来源:互联网 发布:随机抽奖姓名软件 编辑:程序博客网 时间:2024/06/15 20:16
import com.alibaba.fastjson.JSONArray;import com.alibaba.fastjson.JSONObject;public class testJson { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String strJson = "{\"sqls\":[{\"sql\":\"INSERT INTO T_BASE_PERSON (PERSON_ID,PERSON_NAME) VALUES (?,?)\",\"values\":\"0dc11abb-967d-11e3-afc0-000c29c3253b,张三\"},{\"sql\":\"UPDATE T_BASE_CLASS SET CLASS_NAME=? WHERE CLASS_ID=?\",\"values\":\"一年一班,538b7ee7-967d-11e3-afc0-000c29c3253b\"}]}"; JSONObject myObj = JSONObject.parseObject(strJson); JSONArray myArray = myObj.getJSONArray("sqls"); for(int i=0;i<myArray.size();i++) { JSONObject o = myArray.getJSONObject(i); System.out.println(o.get("sql")); System.out.println(o.get("values")); } String strJson1 = "[{\"sql\":\"INSERT INTO T_BASE_PERSON (PERSON_ID,PERSON_NAME) VALUES (?,?)\",\"values\":\"0dc11abb-967d-11e3-afc0-000c29c3253b,张三\"},{\"sql\":\"UPDATE T_BASE_CLASS SET CLASS_NAME=? WHERE CLASS_ID=?\",\"values\":\"一年一班,538b7ee7-967d-11e3-afc0-000c29c3253b\"}]"; JSONArray myArray1 =JSONArray.parseArray(strJson1); for(int j=0;j<myArray1.size();j++) { JSONObject o1 = myArray1.getJSONObject(j); System.out.println(o1.get("sql")); System.out.println(o1.get("values")); } }}
阅读全文
0 0
- 阿里巴巴的FastJSON解析JSON例子,超级好用。
- 阿里巴巴的FastJSON解析JSON例子,超级好用。
- 用阿里巴巴的fastjson工具解析json数据
- Json解析包 阿里巴巴 FastJson 的使用
- FastJson和Gson解析json的小例子
- Json的处理(阿里巴巴的fastjson)
- fastjson 阿里巴巴json使用
- 阿里巴巴fastJson解析工具的demo实现
- 阿里巴巴fastjson: 世界上最快的 Java json 解析包, 2个bug
- JSON数据解析:Gson(谷歌)和fastjson(阿里巴巴)的异同点
- 阿里巴巴FastJson解析
- 阿里巴巴中的FastJson解析
- JSON的解析[Java-JSON、FastJSON、GSON]
- 阿里巴巴Json工具-Fastjson讲解
- 阿里巴巴Json工具-Fastjson讲解
- 阿里巴巴Json工具-Fastjson讲解
- 阿里巴巴封装的FastJSON来转换json字符串
- 阿里巴巴的fastjson比json-lib快10倍
- 对称秘钥与公共秘钥的区别
- HDU2089-不要62
- PathRemoveFileSpec
- android studio 工具
- 关于阿里云业务数据分析
- 阿里巴巴的FastJSON解析JSON例子,超级好用。
- CSDN博客的积分计算方法和博客排名规律
- C++控制台程序判断输入的数字
- MySQL关键字
- pandas rolling_mean
- 使用HttpHandler实现图片防盗链
- HDOJ 2112 HDU Today (STL_map + dijkstra)
- VS2017整合proc(C语言篇)
- MYSQL 最近知识总结(3)