2 回答

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超5個贊
java to javascript:
map.put("name", JSONNull.getInstance())
javascript to hava:
{name : undefined}
或者不傳name。

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超6個贊
private static void each(Map m){
Iterator it = m.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Entry) it.next();
Object value = entry.getValue();
if(value == null) continue;
if(value instanceof List){
System.err.println(1);
Iterator lit = ((JSONArray) value).iterator();
while (lit.hasNext()) {
Object lvalue = lit.next();
each((Map) lvalue);
}
}else if(value instanceof Map){
each((Map) value);
}else if ((value instanceof net.sf.json.JSONNull)){
entry.setValue(null);
}
}
}
添加回答
舉報