Return error pages as JSON

Hi all

we’re working in a headless project and we would want to return the error pages configured in the “web.xml” file as a JSON matching the format returned under the “resourceapi” URL for the rest of the pages

is there a way to configure the jsp files to return a json formatted file insteald of an html page?

thanks in advance

the web.xml error pages are served by tomcat. When you get those the hst is not involved. This is also why they have to be jsp’s, that’s how tomcat works. In most cases you shouldn’t ever hit those error pages, so I’m wondering what the case is here?