Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lossless Serialization of Decimals and Large Numbers in JSON #2767

Closed
2 tasks done
helloanoop opened this issue Aug 6, 2024 · 1 comment · Fixed by #2773
Closed
2 tasks done

Lossless Serialization of Decimals and Large Numbers in JSON #2767

helloanoop opened this issue Aug 6, 2024 · 1 comment · Fixed by #2773
Labels
bug Something isn't working

Comments

@helloanoop
Copy link
Contributor

helloanoop commented Aug 6, 2024

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

There are a number of issues related to

  • Not able to handle large numbers
  • Decimal numbers being converted as strings
  • Trailing zeroes get trimmed

We tried using json-bigint, but that didn't help.
We then tried using lossless-json, but that also failed at the axios layer with the below message

Error occurred in handler for 'send-http-request': TypeError: Do not know how to serialize a BigInt
at stringify ()
at stringifySafely (/Users/anoop/bruno/bruno/node_modules/axios/dist/node/axios.cjs:1436:37)
at Object.transformRequest (/Users/anoop/bruno/bruno/node_modules/axios/dist/node/axios.cjs:1496:14)
at transform (/Users/anoop/bruno/bruno/node_modules/axios/dist/node/axios.cjs:1922:15)
at Object.forEach (/Users/anoop/bruno/bruno/node_modules/axios/dist/node/axios.cjs:283:10)
at Object.transformData (/Users/anoop/bruno/bruno/node_modules/axios/dist/node/axios.cjs:1921:11

Related Issues:

Related PRs:

Solution

Do not compromise the fidelity of the Json string (by doing JSON parse and stringify) before the network request is made

@helloanoop helloanoop added the bug Something isn't working label Aug 6, 2024
@helloanoop helloanoop changed the title Forking Axios to support support Lossless Serialization of Decimals and Large Numbers Lossless Serialization of Decimals and Large Numbers in JSON Aug 7, 2024
helloanoop added a commit that referenced this issue Aug 8, 2024
helloanoop added a commit that referenced this issue Aug 27, 2024
Fix serilization issues of bigint in json body
---------

Co-authored-by: lohit <[email protected]>
@helloanoop
Copy link
Contributor Author

PR #2773 has been merged, This will go out in the v1.27.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant