You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
500 B

//去掉空的children属性
for (int i = 0; i < ja1.size(); i++) {
var jo1 = (JSONObject) ja1.get(i);
if (jo1.getJSONArray("children").size() == 0)
jo1.remove("children");
if (null != jo1.get("children")) {
var ja2 = jo1.getJSONArray("children");
for (int j = 0; j < ja2.size(); j++) {
var jo2 = (JSONObject) (ja2.get(j));
if (jo2.getJSONArray("children").size() == 0)
jo2.remove("children");
}
}
}