I want to split a very large string into multiple lines. When I use next line characters, those characters are displayed in Swagger UI without having multiple lines.
Code is as below:
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Path("test")
@Api(tags = {"Testing"})
public class TestingService {
@Context
private HttpServletRequest request;
@GET
@Path("testing")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Testing",
response = String.class)
public String getString(
throws Exception {
return "abcdef,fghijk";
}
}
Input is:
abcdef,fghijk
Current Output:
{
"messages": "abcdef,fghijk"
}
Expected Output:
{
"messages": "abcdef,
fghijk"
}
I have tried \n
, \\n
, \\\n
and \r\n
.
Note: I am using Jersey Framework for this REST API & Swagger for UI.
Thanks a lot in advance for the help.