To verify a request, we defined a json structure in a variable (global or collection), and need to parse it to check certain data fields against the request reponse.
The only way we’ve been able to do this is with the deprecated language below.
Can anyone point us to a more current way to do this?
This example shows the value (variable) being defined, then parsed.
const obj = {
"eventContext": {
"eventName": "commentCreated",
"eventId": "53973f1d-ec2a-457a-af69-b29bfb016f45",
"eventDatetime": "2022-05-16T15:45:01.4729967-04:00"
},
"commentId": "140c04ed-afe0-4d5f-b283-e574cd63fc47",
"entityType": "story",
"entityId": "c0123e45",
"commentUserId": "01010101010101"
};
postman.setEnvironmentVariable("obj", JSON.stringify(obj));
const obj2 = {
"eventContext": {
"eventName": "moderationCreated",
"eventId": "7f608f6d-fe04-4e8c-85d4-dbd6371bd4df",
"eventDatetime": "2022-05-16T15:45:03.3779789-04:00"
},
"commentId": "c7238f62-534f-41fa-bd95-4673cec6b07b",
"entityType": "moderate",
"entityId": "c1234f56",
"commentUserId": "01010101010101"
};
postman.setEnvironmentVariable("obj2", JSON.stringify(obj2));