How to convert JSONArray to List with Gson? How to convert JSONArray to List with Gson? arrays arrays

How to convert JSONArray to List with Gson?


If you see the answer there, you can notice that the first parameter in the fromJson() method was a String(the json object). Try to use the toString() on the JsonArray like this:-

List<MyModel> myModelList = gson.fromJson(jsonArray.toString(), listType);