import com.google.gson.Gson;
// 将 JSON 字符串转换为 List
String json = "[{\"name\":\"John\", \"age\":30},{\"name\":\"Alice\", \"age\":25}]";
List<Person> personList = new Gson().fromJson(json, new TypeToken<List<Person>>(){}.getType());
JSON格式的字符串转换为 List
最新推荐文章于 2024-03-26 11:06:41 发布