part key code:
private ResponseEntity getResult(String url, HttpEntity<?> entity) {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity responseEntity = restTemplate.exchange(url,
HttpMethod.POST, entity, JSONObject.class);
return responseEntity;
}
private <T> HttpEntity<List<T>> setEntity(List<T> data,HttpHeaders httpHeader) {
HttpEntity<List<T>> entity = new HttpEntity<>(data, httpHeader);
return entity;
}
HttpHeaders httpHeader = this.getHttpHeader(this.serviceName, ttsToken);
HttpEntity<List<T>> entity = this.setEntity(data, httpHeader);
ResponseEntity responseEntity = this.getResult(this.url, entity);
and this httpcode is 200; and My Input is List
this return is message=Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'xxxx1`2[xxxx2]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath '', line 1, position 1., data=null)".