一:String转JsonObject:
JSONObject jSONObject = JSONObject.parseObject(string);
二:获取JsonObject中的value值:
System.out.println("111111111"+jSONObject.getJSONObject("Result").getJSONObject("Result").get("FLinkMan"));
三:JsonObject转ArrayList,遍历ArrayList集合获取key,value值:
思路:JsonObject先转String,在由String转ArrayList
JSONObject customer = (JSONObject) data.get("CustomerID");
String s = JSONObject.toJSONString(customer.get("Name"));
ArrayList<JSONObject> listName = (ArrayList<JSONObject>) JSONObject.parseArray(s,JSONObject.class);
for (Map entity : listName) {
if(entity.get("Key").equals(2052)) {
dataMap.put("customerName", entity.get("Value"));
}
}
标签:String,get,JsonObject,ArrayList,entity,JSONObject,相关,操作 From: https://www.cnblogs.com/pika-pikaqiu/p/17394449.html