I have 3 endpoints which look exactly the same. On one of them I get this exception
"message": "JSON parse error: Unrecognized token 'Reset': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Reset': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 7]"
The DTO I am using for the request has this structure
@Data
public class ValidateResetPasswordReqDto {
@ApiModelProperty(required = true, allowEmptyValue = false, example = "336068069", value = "Social id")
private String socialId;
@ApiModelProperty(required = true, allowEmptyValue = false, example = "0589876541", value = "Phone")
private String phone;
@ApiModelProperty(required = true, allowEmptyValue = false, example = "902679", value = "Reset password code")
private String resetPasswordCode;
}
I get the exception in this piece of code
@SneakyThrows
public <T> ResponseEntity<T> postToExtServices(Object dto,
String url,
Map<String, String> additionalHeaders,
ParameterizedTypeReference<T> responseType) {
String jsonBody = objectMapper.writeValueAsString(dto);
HttpHeaders headers = httpHeadersService.getDefaultHttpHeaders();
additionalHeaders.forEach(headers::set);
HttpEntity<String> request = new HttpEntity<>(jsonBody, headers);
return restTemplate.exchange(
getResourceUrl() + url,
HttpMethod.POST,
request,
responseType
);
}
When I debug I can clearly see that the String jsonBody is getting populated with the dto and cant figure out what is the issue here
This is the body of the request I am sending from Postman
{
"socialId": 222855157,
"phone": "052-3414725",
"resetPasswordCode": "3333"
}