Java 字符串解析
双【】字符串
字符串如下:
如何解析成数组?还请帮忙!
String data = "[[-1,-2,-3],[-2,-3,-4],[-4,-5,-6]]";
List<List<Integer>> doubleLevelList = gson.fromJson(data, new TypeToken<List<List<Integer>>>() {
}.getType());
依赖Gson
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>