Android gson解析json数据工具类

public class JsonUtils {
    private static Gson gson = new GsonBuilder().serializeNulls().create();

    public static String toJson(Object obj) {
        return gson.toJson(obj);
    }

    public static  List parseJsonToList(String json) {
        Gson gson1 = new Gson();
        return gson1.fromJson(json, new TypeToken>() {}.getType());
    }
}

你可能感兴趣的:(android,json,gson,android,JSON与XML,android,工具类大集合)