// Constructs the JSON data
String json = "{\"total\": " + totalRecords + ",\"rows\": [";
int size = currencys.size();
for (int i = 0; i < size; i++) {
Currency instance = currencys.get(i);
Integer id = instance.getId();
String name = CommonUtil.fromNullToEmpty(instance.getName());
String code = CommonUtil.fromNullToEmpty(instance.getCode());
Double rate = instance.getRate();
String rateS = "";
if (rate != null) {
rateS = String.valueOf(rate);
}
String symbol = CommonUtil.fromNullToEmpty(instance.getSymbol());
String status = CommonUtil.fromNullToEmpty(instance.getStatus());
json += "{\"id\":\"" + id + "\",\"currency.id\":\"" + id
+ "\",\"currency.name\":\"" + name
+ "\",\"currency.code\":\"" + code
+ "\",\"currency.rate\":\"" + rateS