拉取的数据要往Mongodb存,留那么多空值没什么用,还不如remove掉,随便写了个,以防以后再遇到
JSONObject j = unlockJson.getJSONArray("records").getJSONObject(0);
System.out.println(j.toJSONString());
// 去掉value为空的键值对
Iterator<Map.Entry<String, Object>> it = j.entrySet().iterator();
while (it.hasNext()){
Map.Entry<String, Object> temp = it.next();
if (temp.getValue().toString().length()<1){
it.remove();
}
}
System.out.println(j.toJSONString());