How to check when I get response that it is in JSON format and to add validation

When I get the response I would like to check whether is in JSON presented and to add validation for true or false in the test.

Hello @satellite-geoscient2 :wave:
Welcome to the community :blush:

I think you can check it that way :point_down:

const jsonData = pm.response.json();

pm.test("Check if response is json", function() {    
    pm.expect(jsonData).to.be.an('object');
});