/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.rest.utility;

/**
 *
 * @author paolo
 */
import org.json.JSONArray;
import org.json.JSONObject;
 
import java.sql.ResultSet;
 
/**
 * Utility for converting ResultSets into some Output formats
 * @author marlonlom
 */
public class Convertor {
 
    /**
     * Convert a result set into a JSON Array
     * @param resultSet
     * @return a JSONArray
     * @throws Exception
     */
    public static JSONArray convertToJSON(ResultSet resultSet)
            throws Exception {
        JSONArray jsonArray = new JSONArray();
        while (resultSet.next()) {
            int total_rows = resultSet.getMetaData().getColumnCount();
            JSONObject obj = new JSONObject();
            for (int i = 0; i < total_rows; i++) {
                obj.put(resultSet.getMetaData().getColumnLabel(i + 1)
                        .toLowerCase(), resultSet.getObject(i + 1));
            }
            jsonArray.put(obj);
        }
        return jsonArray;
    }
 

}
@@ -1,242 +1,29 @@
-/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage it.rest.utility;%0A%0A/**%0A *%0A * @author paolo%0A */
+package it.rest.utility;%0A
 %0Aimp
@@ -175,29 +175,8 @@
 ats%0A
- * @author marlonlom%0A
  */%0A
@@ -916,8 +916,9 @@
   %7D%0A %0A%0A%7D
+%0A

Update Convertor.java