How can Postman compare the value of a written variable with the value from json?

Hey @alexei.taushkanov

The {{...}} syntax isn’t available in the sandbox to use directly in the expect statement like that.

You would need to use it like this:

pm.expect(jsonData.id).to.eql(pm.environment.get("id_user"));

Alternatively, that double curly brace syntax could be used like this:

pm.expect(jsonData.id).to.eql(pm.environment.replaceIn("{{id_user}}"));

6 Likes