'How to get the value of key from the body of Json response using Postman Test?

Hi Team I have response Json whose body is as below

{
"host": "telemarket-backend.val.io",
"ssl-client-verify": "NONE",
"x-request-id": "916633224df75cb3cd728631879612181761",
}

when I am writing test in Postman for the above body as described

const responseJson=pm.response.json();
pm.test("Validate the SSL ",function(){
pm.expect(responseJson.ssl-client-verify).to.eql("None");
});

Above one is not working as expected while the below one is working as expected

pm.test("Validate the host  ",function(){
pm.expect(responseJson.host).to.eql("telemarket-backend.val.io");
});

can you tell me the reason why is it not working and the fix resolution which can work on postman



Solution 1:[1]

Correct solution that I have found out is pm.expect(responseJson[ssl-client-verify]).to.eql("NONE");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jitendra gupta