[GH-ISSUE #4490] [bug]: Cannot read long integer values from response without precision loss #1644

Open
opened 2026-03-16 21:13:32 +03:00 by kerem · 0 comments
Owner

Originally created by @simone-lungarella on GitHub (Oct 29, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4490

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When reading response data having long integer values, it is not possible to avoid precision loss. I have a service that returns a response as following:

{
  "traceID": "a7dab24b4c447a35",
  "spanID": "a7dab24b4c447a35",
  "idNode": 984854404848596256
}

I can see that it is the correct response presented in the ResponseBody tab as this behaviour has been solved in #4083 but when accessing response in the test section there is no way to get this very same response and read the value correctly.

I have tried to read it as suggested pw.response.body and also I've tried to avoid automatic parsing using: JSON.stringify(pw.response). The result seems to be the same. The response is not raw, it is already altered. Also using LJSON to parse the request is not possible within the test scope.

Steps to reproduce

  1. Execute a call towards an API that return a JSON response having long number as values, an example response is:
{
  "traceID": "a7dab24b4c447a35",
  "spanID": "a7dab24b4c447a35",
  "idNode": 984854404848596256
}
  1. Write a test script to read the value of the field: idNode as following:
// Set an environment variable
pw.env.set("nodeId", pw.response.body.idNode);
  1. Check the environment variables and you can see the value is truncated, losing its precision.

Environment

Production

Version

Cloud

Originally created by @simone-lungarella on GitHub (Oct 29, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4490 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior When reading response data having long integer values, it is not possible to avoid precision loss. I have a service that returns a response as following: ```json { "traceID": "a7dab24b4c447a35", "spanID": "a7dab24b4c447a35", "idNode": 984854404848596256 } ``` I can see that it is the correct response presented in the ResponseBody tab as this behaviour has been solved in #4083 but when accessing response in the test section there is no way to get this very same response and read the value correctly. I have tried to read it as suggested `pw.response.body` and also I've tried to avoid automatic parsing using: `JSON.stringify(pw.response)`. The result seems to be the same. The response is not raw, it is already altered. Also using LJSON to parse the request is not possible within the test scope. ### Steps to reproduce 1. Execute a call towards an API that return a JSON response having long number as values, an example response is: ```json { "traceID": "a7dab24b4c447a35", "spanID": "a7dab24b4c447a35", "idNode": 984854404848596256 } ``` 2. Write a test script to read the value of the field: `idNode` as following: ```javascript // Set an environment variable pw.env.set("nodeId", pw.response.body.idNode); ``` 3. Check the environment variables and you can see the value is truncated, losing its precision. ### Environment Production ### Version Cloud
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1644
No description provided.