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
As an additional answer, it can also be made shorter.
List customerList = CustomerDB.selectAll(); JsonArray result = (JsonArray) new Gson().toJsonTree(customerList, new TypeToken>() { }.getType());