I am trying to convert ArrayList of custom class to JsonArray. Below is my code. It executes fine but some JsonArray elements come as zeros even though they are numbers in the A
Model.class
ArrayList listOfObjects = new ArrayList();
List to JSON
String jsonText = new Gson().toJson(listOfObjects);
JSON to LIST
Type listType = new TypeToken>() {}.getType(); List myModelList = new Gson().fromJson(jsonText , listType);