1.7、JSON字符串(数组类型)转为List<>

实际上和JSON字符串(数组类型)转换为JavaBean一样。

private static final String  JSON_ARRAY_STR = "[
{\"studentName\":\"lily\",\"studentAge\":12},
{\"studentName\":\"lucy\",\"studentAge\":15}
]";

public static void test(){

    List<Student> students = JSON.parseObject(json,new TypeReference<List<Student>>(){});
}

results matching ""

    No results matching ""