diff --git a/src/main/java/org/wise/portal/presentation/web/controllers/project/ProjectAPIController.java b/src/main/java/org/wise/portal/presentation/web/controllers/project/ProjectAPIController.java index 4a0b8bae9..e4a9c493f 100644 --- a/src/main/java/org/wise/portal/presentation/web/controllers/project/ProjectAPIController.java +++ b/src/main/java/org/wise/portal/presentation/web/controllers/project/ProjectAPIController.java @@ -18,6 +18,7 @@ import org.wise.portal.domain.project.Project; import org.wise.portal.domain.project.impl.ProjectImpl; import org.wise.portal.domain.user.User; +import org.wise.portal.domain.usertag.UserTag; import org.wise.portal.presentation.web.controllers.ControllerUtil; import org.wise.portal.service.portal.PortalService; import org.wise.portal.service.project.ProjectService; @@ -127,12 +128,20 @@ private JSONArray getProjectsWithTagsJSON(User user, List projectList) JSONArray projectsJSON = new JSONArray(); for (Project project : projectList) { JSONObject projectJSON = ControllerUtil.getProjectJSON(project); - projectJSON.put("tags", userTagsService.getTagsList(user, project)); + projectJSON.put("tags", convertTagsToJsonArray(userTagsService.getTagsList(user, project))); projectsJSON.put(projectJSON); } return projectsJSON; } + private JSONArray convertTagsToJsonArray(List tags) { + JSONArray tagsJSONArray = new JSONArray(); + for (UserTag tag : tags) { + tagsJSONArray.put(tag.toMap()); + } + return tagsJSONArray; + } + private JSONObject populateProjectMetadata(JSONObject projectLibraryGroup) throws JSONException { if (projectLibraryGroup.getString("type").equals("group")) { JSONArray children = projectLibraryGroup.getJSONArray("children");