String Comparision

I have a result in the postman

  "results": [
      "emails": {
        "verified": [
        "unverified": [
      "identities": [
          "email": "user_anudeep16"

In the test, I am trying to compare the value of email from identities to unverified
and print if they are same or different, but it is always coming true, eventhough the values are different. Can anyone help me what am I doing wrong

pm.test("Body is correct", function () {
    var jsonData = pm.response.json();
    var counter = jsonData.results[0];
        console.log("value Matched");

Hey @ereddy068

I’m not sure what you’re trying to do with that if statement and it’s mixing 2 different things up at the same time.

Might be worth having a quick look over how those conditional statements work:

For your assertion against the response, you would probably just need to do this:


I don’t know the full context of what you’re trying to do here so this is only a basic solution.

Hi @dannydainton,

Thank you for the response.

I need to evaluate some more code after comparing the values.

If I use this


will I be able to write some more code and continue my test.

Basically I want to if else condition with the values.

Depends what you ultimately want to do with the information.

You can get all those data points, do your if/else statements etc. all outside of a test but you’re also not limited to having just a single expect statement in a test.