标签:object ring repeat round min ack sys tostring one
alibaba的JSON.toString会把值为null的字段去掉,谨记
Map<String,Object> map = new HashMap<>();
map.put("a", "1");
map.put("b", "2");
map.put("c", null);
String jsonString = JSON.toJSONString(map);
System.out.println(jsonString);
结果:{"a":"1","b":"2"}
Map<String,Object> map = new HashMap<>();
map.put("a", "1");
map.put("b", "2");
map.put("c", "");
String jsonString = JSON.toJSONString(map);
System.out.println(jsonString);
结果:{"a":"1","b":"2","c":""}
alibaba的JSON.toString会把值为null的字段去掉,谨记
标签:object ring repeat round min ack sys tostring one
原文地址:https://www.cnblogs.com/bchange/p/9168352.html