How do I capture the real value?

Hello,

In my postman, I get a body output like this

[
{
“description”: “This escapes all the characters correctly \\\\network\\folder\\UNC\\path”,
}
]

But when I setup a test such as
pm.environment.set(“VARIABLE”, pm.response.json()[0].description);
or
pm.test(pm.response.json()[0].description)

The Test and the Variable equal: This escapes all the characters correctly \\network\folder\UNC\path

It loses the Escape backslashes… which is probably by design… but I WANT those escape backslashes. Is there an easy way?

I got it… sorry, just needed to research longer.

Set the test to pm.environment.set(“VARIABLE”, JSON.stringify(pm.response.json()[0].description))

Here is where I found the original answer.

1 Like