POST Response Assertion to search through all ITEM.s to return a value if found

My question: I am trying to validate a POST Response, I get many results and I just want to confirm if the value exists and move on. I suspect this is an often-wanted assertion so I am pretty confident I am making it too hard or flat-out misunderstanding.

Details (like screenshots):
My Response is 2000 lines long and I want to search for a specific ITEM in the response, the ITEM response is an array and I just want it to cycle/loop through the ITEM and find a value:


I’ve already tried:
I have been trying a variation from another help topic on this forum with no luck but here is my assertion:

var CourseId1 = pm.globals.get(“gCourseId1”);
let jsonData = pm.response.json();

pm.test("Verify Course was added to requiredCourseDetailList from courseCategoryDetailList1: " + CourseId1, () => {
let requiredCourseId = _.values(jsonData[‘payload’].data.requiredCourseDetailList);
_.each(requiredCourseId, (item) => {pm.expect(item.requiredCourseId).to.equal(CourseId1);

Postman uses JavaScript under the hood.

There are two main methods for searching arrays, and this is via “find” and “map”.

If you could provide a sample JSON file with 3 entries under the course detail list, I can probably provide an example using one of the methods detailed above.

You should be able to find the required course that equals a particular number, and also include some of the other fields to help with the assertion.

I was able to figure it out using the following:

var jsonData = pm.response.json();
var requiredCourseId = => i.requiredCourseId);
pm.test("The requiredCourseDetailList contains the correct course: " + CourseId1, function () {