package com.fastech.monitor_ui.util;
import java.util.HashMap;import java.util.List;import java.util.Map;import com.fastech.monitor_ui.model.Customize_Configuration;import net.sf.json.JSONArray;import net.sf.json.JsonConfig;public class JsonUtil { public static Map jsonToMap(String jsonStr) { net.sf.json.JSONObject jo = net.sf.json.JSONObject.fromObject(jsonStr); Map<String, Class> classMap = new HashMap<String, Class>(); classMap.put("extend", HashMap.class); Map<String, Object> retMap = (Map<String, Object>) net.sf.json.JSONObject.toBean(jo, HashMap.class, classMap); return retMap; } /** * json 转 List<T> */ public static List<Map<String,String>> jsonToList(String jsonString) { @SuppressWarnings("unchecked") net.sf.json.JSONArray jo = net.sf.json.JSONArray.fromObject(jsonString); List<Map<String,String>> ts = (List<Map<String,String>>) JSONArray.toArray(jo, Map.class); return ts; }}