使用gson解析数组格式的json字符串 Java
Gson gson
= new
Gson();
Type type
= new TypeToken
<List
<String
>>() {}.getType();
List
<String
> jsonList
= gson
.fromJson(json
,type
);
Kotiln
var stringList
: ArrayList
<String
>? = null
val gson
= Gson()
val type
= object
: TypeToken
<List
<String
>?>() {}.type
stringList
=gson
.fromJson
<List
<String
>>(json
, type
) as ArrayList
<String
>?
转载请注明原文地址:https://tech.qufami.com/read-7450.html