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>

 

相关文章:

  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案