I am not able to convert a JSON Array into a GroupModel
array. Below is the JSON I used:
[{
\"description\":\"My expense to others\",
\"items\"
You need to use a TypeToken
to capture the generic type of the array, and you need this to be the type that GSON sees as the target, instead of just GroupModel::class
it is really a list of those. You can create a TypeToken
and use it as follows:
Type groupListType = new TypeToken>() {}.getType();
var model = gson.fromJson(inputString, groupListType);