注意 map.toString() 和 JSONObject.toJSONString( map ) 的结果是有区别的,
分享于 点击 29952 次 点评:256
注意 map.toString() 和 JSONObject.toJSONString( map ) 的结果是有区别的,
Map<String, Integer> map = new HashMap<>();
map.put( "staff9", 1 );
map.put( "staff1", 3 );
System.out.println( map.toString() ); // 结果是 {staff9=1, staff1=3}
// JSONObject 是 com.alibaba.fastjson.JSONObject
System.out.println( JSONObject.toJSONString( map ) ); // 结果是 {"staff9":1,"staff1":3}
相关文章
- 暂无相关文章
用户点评