What you have in your json is a List<Cast>
, and the Cast
class is a simple String
so what you could do is get the list of Cast
and then get the list[index].name
to get the String
In case you’d like a List<String>
you should have this as json
[
"Jhon",
"Anne",
"Carl"
]
Then you’d be able to do this :
val gson = GsonBuilder().create()
val list = gson.fromJson<ArrayList<String>>(stringObject, object :TypeToken<ArrayList<String>>(){}.type)
0
solved How to use Gson to convert simple object to string? [closed]