src/main/java/com/whyc/util/JsonUtil.java
@@ -2,6 +2,9 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; import java.lang.reflect.Type; public class JsonUtil { @@ -22,4 +25,15 @@ return new Gson(); } public static <T> T getObject(String jsonstring, Type listtype){ Gson gson=new Gson(); T t=null; try { t=gson.fromJson(jsonstring, listtype); } catch (JsonSyntaxException e) { e.printStackTrace(); } return t; } }