I have the following problem: the request body does not display a string if there are quotes or curly braces in the string.
For example, in this code
HttpContext context = server.createContext("/api/hello", (exchange -> {
if ("POST".equals(exchange.getRequestMethod())){
...
OutputStream output = exchange.getResponseBody();
output.write("{\"number\":12}".getBytes());
output.flush();
} else {
exchange.sendResponseHeaders(405, -1);
}
}));
string "{\"number\":12}" does not display. At the same time if I change it to string "flower" (without quotes or curly braces), then it displays normally. How to display a string like "{\"number\":12}" ? I need it to display JSON in the response body.