Asserting that an object is contained
GET {{mockBaseUrl}}/created
You can check that an object is part of a parent object.
/*
response has the following structure:
{
  "id": "d8893057-3e91-4cdd-a36f-a0af460b6373",
  "created": true,
  "errors": []
}
*/
pm.test("Object is contained", () => {
  const expectedObject = {
    "created": true,
    "errors": []
  };
  pm.expect(pm.response.json()).to.deep.include(expectedObject);
});
Using
.deepcauses all.equal,.include,.members,.keys, and.propertyassertions that follow in the chain to use deep equality (loose equality) instead of strict (===) equality. While the.eqlalso compares loosely,.deep.equalcauses deep equality comparisons to also be used for any other assertions that follow in the chain, while.eqldoes not.
RESPONSES
status: Created
{"id":"d8893057-3e91-4cdd-a36f-a0af460b6373","created":true,"errors":[]}