diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java index 3112897..04ad975 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java @@ -289,16 +289,14 @@ public class RepositoryServiceImpl implements RepositoryService { requestFilter.setEnglishname(englishName); try { - String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class); + Map rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, Map.class); if (rs == null) { logger.error("DSM response is null : [url={}]", uriComponents.toUri()); } else { - JSONObject response = new JSONObject(rs); - JSONArray jsonArray = (JSONArray) response.get("datasourceInfo"); - Header header = mapper.readValue(response.get("header").toString(), Header.class); + Header header = mapper.readValue(mapper.writeValueAsString(rs.get("header")), Header.class); snippets = Paging.of(header, mapper.readValue( - String.valueOf(jsonArray), + mapper.writeValueAsString(rs.get("datasourceInfo")), mapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class))); }