To validate the Json format and contents I recommend you to use the AJV library, it has powerful features to validate Json response contents. The following code might solve your problem.
pm.test(“Response contains property”,function() {
var Ajv = require(‘ajv’);
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
//Json schema to be validated
var schema = { “type”: “array”, “items”: { “type” : “object”, “required”: [“Id”] } };
var jsonData = pm.response.json();
var jsonValid = ajv.validate(schema, jsonData);
if(!jsonValid){
console.log("JSON Schema Validation Error: " + JSON.stringify(ajv.errors));
}
pm.expect(jsonValid).to.be.true;
});
Best Regards!