Need to display the response as application/json instead of text/html

I am using the swagger library (https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.17.6/swagger-ui-bundle.js). Currently the response is displaying as text/html, I need to change this to application/json. Anyone help me to do this please?
Below is the current and expected response for reference.
Current:

Expected:
{
“type1”: “test1”,
“type2”: “test2”
}

If this is an issue with the library behaviour you should report it on their issue page: https://github.com/swagger-api/swagger-ui/issues