java 测试处理json数据
来源:互联网 发布:罗技游戏鼠标推荐 知乎 编辑:程序博客网 时间:2024/06/06 18:02
String a="{'plan':[{'PLAN_START_DATE':'1','ID':'','PLAN_END_DATE':'2012-04-30'},{'PLAN_START_DATE':'1','ID':'b2','PLAN_END_DATE':'2013-05-31'}]}";
JSONObject object =JSONObject.fromObject(a);
JSONArray array=object.getJSONArray("plan");
String tID="";
String tSdate="";
String tEdate="";
Map outParameters=new HashMap();
for (int i = 0; i < array.size(); i++) {
JSONObject getData=array.getJSONObject(i);
tID=tID+getData.get("ID").toString()+",";//拼接字符串ID
tSdate=tSdate+getData.get("PLAN_START_DATE").toString()+",";
tEdate=tEdate+getData.get("PLAN_END_DATE").toString()+",";
}
Integer index1=tID.lastIndexOf(",");
tID=tID.substring(0,index1);
Integer index2=tSdate.lastIndexOf(",");
tSdate=tSdate.substring(0,index2);
Integer index3=tEdate.lastIndexOf(",");
tEdate=tEdate.substring(0,index3);
System.out.println(tID);
System.out.println(tSdate);
System.out.println(tEdate);
JSONObject object =JSONObject.fromObject(a);
JSONArray array=object.getJSONArray("plan");
String tID="";
String tSdate="";
String tEdate="";
Map outParameters=new HashMap();
for (int i = 0; i < array.size(); i++) {
JSONObject getData=array.getJSONObject(i);
tID=tID+getData.get("ID").toString()+",";//拼接字符串ID
tSdate=tSdate+getData.get("PLAN_START_DATE").toString()+",";
tEdate=tEdate+getData.get("PLAN_END_DATE").toString()+",";
}
Integer index1=tID.lastIndexOf(",");
tID=tID.substring(0,index1);
Integer index2=tSdate.lastIndexOf(",");
tSdate=tSdate.substring(0,index2);
Integer index3=tEdate.lastIndexOf(",");
tEdate=tEdate.substring(0,index3);
System.out.println(tID);
System.out.println(tSdate);
System.out.println(tEdate);
- java 测试处理json数据
- java处理json数据
- java处理JSON格式数据
- jquery处理json数据
- Json数据的处理
- JSON异步处理数据
- Ajax 处理 Json 数据
- JS处理JSON数据
- python处理json数据
- 页面处理json数据
- 处理json数据
- js 处理json 数据
- JS处理JSON数据
- C#处理Json数据
- json数据基础处理
- ajax处理Json数据
- perl 处理 json 数据
- jquery处理json数据
- Bitmap文件结构探讨
- 写给Git初学者的7个建议
- 积分图像
- 安卓自测试题——第二十一期
- MediaProvider数据库模式
- java 测试处理json数据
- 利用邮件营销玩转促销
- BCM4330 BlueTooth 调试记录
- 设计模式六大原则(5):迪米特法则
- Documentation_scheduler_sched-arch.txt
- Android RILD学习
- Dev的等待提示框
- 【用C#写游戏-XNA游戏编程】坦克大战(一) 初探XNA
- 虫趣:FAST_MUTEX死锁