try {
JSONArray array =new JSONArray ();
// JSONObject arr_ = new JSONObject();//注意这个只能写在下面
for (int i = 0; i < data.size(); i++) {
JSONObject arr_ = new JSONObject();
arr_.put("DevEUI", data.get(i));
System.out.println(data.get(i));
array.add(arr_);
arr_.clear();
System.out.println("******array.toString()******"+array.toString());
}
out.print(array.toString());
} catch (JSONException e) {
e.printStackTrace();
}
JSONArray array =new JSONArray ();
// JSONObject arr_ = new JSONObject();//注意这个只能写在下面
for (int i = 0; i < data.size(); i++) {
JSONObject arr_ = new JSONObject();
arr_.put("DevEUI", data.get(i));
System.out.println(data.get(i));
array.add(arr_);
arr_.clear();
System.out.println("******array.toString()******"+array.toString());
}
out.print(array.toString());
} catch (JSONException e) {
e.printStackTrace();
}