Demo app with description and integration tests illustrating the issue: https://github.com/noavarice/spring-boot-json-latin1-demo/tree/main

In short: at some point ISO-8859-1 charset is included in Content-Type header when setting JSON response body as follows (with all the default application settings):

final var result = new Greeting("Hello, world!");
final String json = objectMapper.writeValueAsString(result);
response.getWriter().write(json);
response.setContentType(MediaType.APPLICATION_JSON_VALUE);

It looks like default response charset is not being included in the response (you can say it explicitly, but it's disabled by default), so charset somehow defaults to Latin-1 as set in org.apache.coyote.Constants#DEFAULT_BODY_CHARSET. I'm not entirely sure if this an issue with Spring, but likely it is.

I wouldn't even notice it if not Bruno API client failing because of this charset with Error invoking remote method 'send-http-request': TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: ISO-8859-1 error (which is kind of normal because JSON response assumed to be in UTF-8)

Comment From: wilkinsona

Thanks for the report. Unfortunately, I don't think there's anything that we can do about it as the behavior is determined by the Servlet specification with which Tomcat is complying. In the absence of the response's character encoding being set through setCharacterEncoding or setContentType, the default character is specified to be ISO-8859-1. That's what is happening here as you haven't called setCharacterEncoding and the content type that you have specified does not provide any charset information.

From the sample's README:

Also, there are integration tests demonstrating that issue does not reproduce when testing using MockMvc (no charset included at all)

This happens because Tomcat isn't involved so the default character encoding isn't being set. Strictly speaking, it could be argued that this is a bug in Spring Framework's mock response as it isn't completely compliant with the Servlet spec. Please open a Spring Framework issue if you would like to pursue this.