ver1.2.58默认配置下 value为null的项 不展示到JSONString空JSON put value为null的对象后 isEmpty 返回false KeySet不为空让人很困扰
gudnpqoy1#
JSONObject j = JSONObject.parseObject("{}"); j.put("3", null); System.out.println(j.keySet()); System.out.println(j.size());
I tried like this. It seems happen what you said.But JSONObject is implements from Map.You problem is why Map allows put data like ("3", null).I suggest to use Map.containsValue(null) to check null-value.
1条答案
按热度按时间gudnpqoy1#
I tried like this. It seems happen what you said.
But JSONObject is implements from Map.
You problem is why Map allows put data like ("3", null).
I suggest to use Map.containsValue(null) to check null-value.