I have a spring-boot project (spring-boot version: v2.3.0.RELEASE). In my api I wish to receive String body, that I will then handle as I please. Problem is, that if this String body has an utf-8 character in it, it somehow changes the string:
@RequestMapping(value= "/target", method = RequestMethod.POST)
public List<Target> createTarget(@RequestBody String body) {
return this.createTargets(body);
}
If there's no utf-8 characters in the string (which is json btw), then when I debug the value of body variable, it looks ok. But when there are utf-8 characters that I try to post to the api, then what happens is that last character of that whole body string is stripped off. I don't know why is this happening? Tried some fixes I found over stackoverflow but no help so far =/. My case is that I send a json string that contains an array. So the last square bracked ] is being stripped off and I have no clue why.