RestTemplate restTemplate = new RestTemplate();
ObjectMapper jsonToObjectMapper = new ObjectMapper();
//json attributes which cannot be recognized is ignored, ingore unused attribute in json
jsonToObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String result = restTemplate.getForObject(url+"?id=" + id, String.class);
LOGGER.debug("the result getting from dt --->\n" + result);
List<ReceiveAttributeTO> receiveAttributeTOs = new ArrayList<ReceiveAttributeTO>();
if (!StringUtils.isEmpty(result)) {
try {
JSONObject jObject = new JSONObject(new JSONTokener(result));
JSONObject array = (JSONObject) jObject.get("_embedded");
JSONArray facilityAttributeseArray = (JSONArray) array.get("facilityAttributeses");
if(facilityAttributeseArray != null && facilityAttributeseArray.length() > 0){
for(int i=0; i < facilityAttributeseArray.length(); i++){
Object obj = facilityAttributeseArray.get(i);
ReceiveAttributeTO receiveAttributeTO = jsonToObjectMapper.readValue(obj.toString(), ReceiveAttributeTO.class);
receiveAttributeTOs.add(receiveAttributeTO);
}
}