import net.sf.json.JSONNull;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.Iterator;
public class TestJSON extends JsonUtil {
public static void main(String[] args) {
String str = "{body:{title:[{id:100,name:lisan,age:null,index:[{title:穿衣,age:null,zs:较冷}]},{id:1001,age:null,name:lisan1,index:[{title:穿衣1,age:null,zs:较冷1}]}]}}}";
JSONObject object = new JSONObject(str);
System.out.println(object);
JSONObject filterNull = filterNull(object);
System.out.println(filterNull);
}
/**
* 将json对象中包含的null和JSONNull属性修改成
JSONObject怎么将null的值替换为 "" 空字符串
最新推荐文章于 2023-06-20 17:45:29 发布