对象转Json字符串
String string = new Gson().toJson(object);
Json字符串转对象
Object object = new Gson().fromJson(string, Object.class);
Json字符串转数组
List<Object> list = new Gson().fromJson(string, new TypeToken<List<Object>>() {}.getType());
对象转Json字符串
String string = new Gson().toJson(object);
Json字符串转对象
Object object = new Gson().fromJson(string, Object.class);
Json字符串转数组
List<Object> list = new Gson().fromJson(string, new TypeToken<List<Object>>() {}.getType());