Map, List conversion in FastJson

Map to JSONObject

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

 

 

JSONObject to Map

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

Note: JSON.parseObject() can also convert

 

 

List to JSONArray

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

 

JSONArray to List

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

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326296973&siteId=291194637