public static void main(String[] args) { String jsonString = "[1,2,3,4]"; Gson gson = new Gson(); Type type = new TypeToken<List<Integer>>() { }.getType(); List<Integer> list = gson.fromJson(jsonString, type); System.out.println(list); }
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>