2

I Have an API that returns the following (example):

{"rate": 3.568640920671274015}

In the Tests space, I try to retrieve the rate value:

pm.test("Set variables", function () {
var jsonData = pm.response.json(); 
pm.environment.set('new-rate', jsonData.rate);

But as result, I get only:

3.568640920671274

It seems that Postman is truncating the result. Is there a way to avoid that?

PS: The value came from a decimal. (inside de API).

Totalys
  • 445
  • 2
  • 10
  • 25

1 Answers1

2

Doing something like this:

pm.environment.set('new-rate', jsonData.rate.toPrecision(18));

worked to me.

Totalys
  • 445
  • 2
  • 10
  • 25