Swashbuckle can automatically generates API documentation based on code (with details return model)
[HttpGet]
public ActionResult<List<Student>> GetStudents()
{
return CollegeRepository.Students;
}
Is there any way to make Swashbuckle automatically generates API documentation a JsonResult?
[HttpGet]
public JsonResult GetStudents()
{
var json = new JsonResult(new
{
data = CollegeRepository.Students,
message = "success"
});
json.StatusCode = StatusCodes.Status200OK;
return json;
}

You could do something similar as below.
In this above, I have saved file on the basis of time. You could modify it as per you need.
It use
SerializeAsJsonfunction fromISwaggerProviderwhich returns Json data as you wanted.