fastjson与各类型的转换

前端之家收集整理的这篇文章主要介绍了fastjson与各类型的转换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

参考:https://www.cnblogs.com/ceshi2016/p/7381478.html

http://www.cnblogs.com/goody9807/p/4244862.html

 

/**map转Json对象**/ Map<String,String> map = new HashMap<String,String>(); JSONObject jsonObject = JSONObject.parSEObject(JSON.toJSONString(map)); /**Json对象转map**/ Map<String,Object> map2 = JSONObject.toJavaObject(jsonObject,Map.class); /**将List转换成JSONArray**/ List<String> list = new ArrayList<String>(); JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(list)); /**将JSONArray转换成List**/http://www.cnblogs.com/goody9807/p/4244862.html /**字符串转Json对象**/ String jsonInfo = ""; JSONObject jsonObject2 = JSONObject.parSEObject(jsonInfo); /**字符串转Json对象**/ String jsonStrng = JSON.toJSONString(jsonObject2);

猜你在找的Json相关文章