public class JSONExporterCls implements JSONExporter {
public JSONArray convertLTToJSON(Collection<LearningTool> learningTools)
throws JSONException {
JSONArray curArray = new JSONArray();
for (int i = 0; i < learningTools.size(); i++) {
JSONObject obj = new JSONObject();
LearningTool currentltools = ((List<LearningTool>) learningTools)
.get(i);
DescriptionNode node = new SimpleDescriptionNodeFactory()
.createNode(currentltools);
obj.put("title", node.getTitle());
obj.put("description", node.getDescription());
obj.put("toolURL", node.getToolURl());
obj.put("cost", node.getToolCost());
obj.put("availability", node.getToolAvailability());
obj.put("openSource", node.isOpenSource());
obj.put("launched", node.getLaunchedTime());
obj.put("registration", node.registration());
obj.put("hasFeature", node.getFeatures());
obj.put("supportedMobileDevices", node.getsupportedMobileDevice());
obj.put("supportedOS", node.getsupportedOS());
curArray.put(obj);
}
return curArray;
}