How to account for a Response Body with a possible JSON or HTML format?

Hello all!

In my Postman- Tests I am trying to account for the different Response Bodies I get from the API server.

So far I was able to account for two types of JSON responses (one with an array and one without) by using TRY-CATCH logic on the response. I was lucky and that solution was fairly straight forward.

I’m now seeing that the Response Body could also return in HTML and I’m not sure how to account for it.

I saw other posts about using cheerio.js to parse HTML responses but I couldn’t figure out how to apply it here. Any help would be greatly appreciated, thanks!