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