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

The “id_user” variable has the value “3”. the “id” from json is equal to “3”.


Using this command, I try to compare values. Returns an error:

AssertionError: expected 3 to deeply equal ‘{{id_user}}’

If the code above is replaced with:

pm. expert(json eql(3);

Everything works.

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

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:


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



Returns an error: Your test name | AssertionError: expected 3 to deeply equal ‘3’. =(
Is it possible that the value “id_user” was written in string format?

That can be handled like this, it will turn the variable saved as a string into an integer.