Jacksonとか使うといいとおもますよ。
https://mvnrepository.com/artifact/com.fasterxml.jackson
kotlin
1import com.fasterxml.jackson.databind.ObjectMapper
2import java.io.StringReader
3
4object xxJsonA {
5 @JvmStatic
6 fun main(args: Array<String>) {
7 val json = """ { "hoge" : [[1,1],[2,2],[3,3]] } """
8 val obj = ObjectMapper().readValue(StringReader(json), Map::class.java)
9 println(obj)
10 // {hoge=[[1, 1], [2, 2], [3, 3]]}
11
12 val arrayhoge = ObjectMapper().readValue(StringReader(json), ArrayHoge::class.java)
13 println(arrayhoge)
14 // ArrayHoge(hoge=[[I@27c20538, [I@72d818d1, [I@6e06451e])
15
16 val listhoge = ObjectMapper().readValue(StringReader(json), ListHoge::class.java)
17 println(listhoge)
18 // ListHoge(hoge=[[1, 1], [2, 2], [3, 3]])
19 }
20
21 data class ArrayHoge(var hoge: Array<IntArray> = arrayOf())
22 data class ListHoge(var hoge: List<List<Int>> = listOf())
23}