FastJson中 Map, List转换

Map转JSONObject

JSONObject json = JSONObject.parseObject(JSON.toJSONString(itemMap));

JSONObject转Map

Map<String, Object> map = JSONObject.toJavaObject(itemJSONObj, Map.class);

注:JSON.parseObject()同样可以转换

List转JSONArray

JSONArray array = JSONArray.parseArray(JSON.toJSONString(itemList));

JSONArray转List

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

猜你喜欢

转载自z724130632.iteye.com/blog/2380268