Answers for "var jsonData = pm.response.json(); console.log(jsonData).value"

0

var jsonData = pm.response.json(); console.log(jsonData).value

pm.test("Check the country filter is allowed", function () {
    // Parse response body
    var jsonData = pm.response.json();

    // Find the array index for the COUNTRY
    var countryFilterIndex = jsonData.filters.map(
            function(filter) {
                return filter.name; // <-- HERE is the name of the property
            }
        ).indexOf('COUNTRY'); // <-- HERE is the value we are searching for

    // Get the country filter object by using the index calculated above
    var countryFilter = jsonData.filters[countryFilterIndex];

    // Check that the country filter exists
    pm.expect(countryFilter).to.exist;

    // Check that the country filter is allowed
    pm.expect(countryFilter.isAllowed).to.be.true;
});
Posted by: Guest on August-26-2021

Code answers related to "var jsonData = pm.response.json(); console.log(jsonData).value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language