public static JSONObject convertToJSON(Properties properties) throws JSONException {
        JSONObject jsonObject = new JSONObject();
        Enumeration e = properties.propertyNames();

        while (e.hasMoreElements()) {

            String key = (String) e.nextElement();
            jsonObject.put(key, properties.getProperty(key));
        }
        return jsonObject;
    }