import org.json.JSONObject;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class CourseFactory {
    public static JSONObject create(Element element) {
        JSONObject course = new JSONObject();
        Elements elements = element.getElementsByTag("td");

        course.put("course", elements.get(0).text());
        course.put("courseName", elements.get(1).text());
        course.put("instructor", elements.get(2).text());

        JSONObject hours = new JSONObject();
        hours.put("lecture", elements.get(3).text());
        hours.put("lab", elements.get(4).text());
        course.put("hours", hours);

        JSONObject credits = new JSONObject();
        credits.put("bilkent", elements.get(5).text());
        credits.put("ects", elements.get(6).text());
        course.put("credits", credits);

        JSONObject quotas = new JSONObject();
        quotas.put("total", elements.get(7).text().split(" ")[0]);
        quotas.put("available", elements.get(12).text().split(" ")[0]);
        course.put("quotas", quotas);

        course.put("schedule", elements.get(14).text());

        return course;
    }
}

@@ -291,111 +291,557 @@
     
-course.put(%22course%22, elements.get(0).text());%0A        course.put(%22courseName%22, elements.get(1).text());
+String id = elements.get(0).text();%0A        course.put(%22id%22, id);%0A%0A        JSONObject courseDetails = new JSONObject();%0A        String department = id.split(%22-%22)%5B0%5D.replaceAll(%22%5B0-9%5D%22, %22%22);%0A        courseDetails.put(%22department%22, department);%0A        String number = id.split(%22-%22)%5B0%5D.replaceAll(%22%5BA-Z%5D%22, %22%22);%0A        courseDetails.put(%22number%22, number);%0A        String section = id.split(%22-%22)%5B1%5D;%0A        courseDetails.put(%22section%22, section);%0A        courseDetails.put(%22name%22, elements.get(1).text());%0A        course.put(%22course%22, courseDetails);%0A%0A
 %0A   

Update course json representation