fun main() {
val obj = Data1(
f1 = listOf(Data(1)),
f2 = mapOf(
1 to listOf(
Data(2),
Data(22)
),
2 to listOf(
Data(3),
Data(33)
)
)
)
val str = JSON.toJSONString(obj)
val a = JSON.parseObject(str, Data1::class.java)
print(a)
}
data class Data(
val id: Int
)
data class Data1(
val f1: List<Data> = listOf(),
val f2: Map<Int, List<Data>> = mapOf()
)
暂无答案!
目前还没有任何答案,快来回答吧!