The response id is 9223372036854250224 but when I use console.log(jsonData.id); it is 9223372036854250000

This is the response
{
ā€œidā€: 9223372036854250224,
ā€œcategoryā€: {
ā€œidā€: 2,
ā€œnameā€: ā€œCatsā€
},
ā€œnameā€: ā€œTomā€,
ā€œphotoUrlsā€: ,
ā€œtagsā€: ,
ā€œstatusā€: ā€œavailableā€
}

When I run this scripts

var jsonData = pm.response.json();

console.log(jsonData.id);

The value in the console is
9223372036854250000

9223372036854250224 - The response value
9223372036854250000 - console value

What Iā€™m doing wrong?

Hi @MarkoSorokopud

Reproduced the same output on my machine, looks like itā€™s a bug, I have raised a ticket on GitHub.

Have been informed that this is JavaScript related not Postman related;

Hope this helps.

Thank you for the quick response James Wadley! Yes, will try to do it, but Iā€™m not sure what exactly is meant by that, if the value is the Int in the API, how I handled it as a stringā€¦

  1. I have a string responseBody
  2. I need to access Id value 9223372036854245504
  3. for that I need to represent responseBody as JSON
    and at that stage, it is already brokenā€¦ I wonder how vdespa expected to handle this, maybe I miss somethingā€¦

As soon as you apply JSON.parse to this object, your data will be corrupted.

You have two options:

  1. Change the API or talk with the API developer to convert that number into a string. Some APIs provide a separate property as a string.

  2. Develop a regex to put quotes around the long number before parsing it.

1 Like

Thank you for the answer mister Valentin!
Will try the second option,
Glad to receive the answer from the Guru, you inspired me to develop the ā€˜API testing course for testersā€™ and I faced this obstacle during developing it)
Thank you for the help, wish you all the best!

I would be very interested in hearing more about the ā€œAPI testing course for testersā€!!

The free version of the course is already available on Udemy.
Mostly it is about manual testing of the APIā€™s
I started to work on it in February 2022 butā€¦ Iā€™m from Ukraine and in Ukraine so it was very very bad timing, horrible timingā€¦ you know, itā€™s not an easy task to work on the course during such huge amount of sā€¦ ā€œstressā€ lets call it ā€œstressā€ā€¦)))) (((( - (brackets mean to show the mixed emotions)

You can get familiar with the course via link

If everything will beā€¦ lets say ā€œfineā€. I will be able to finish the full much much more advanced version of the course till November, butā€¦ I donā€™t knowā€¦ hopefully I will ))))(((( -mixed emotions again)))

I use Postman for testing in my course, And I love the Postman, I really do) Want to show testers that if you use the Postman features properly, API testing becomes easy to do. But it is the second part of the course, Iā€™m busy on it now.

1 Like

Should definitely share in the community showcase section!

Got it, thank you! Will do once the full version of the course will be available I will create a free coupon for the Postman community and share the full course!

1 Like