Skip to content

Rust: Serialize 64-bit integers as strings in xdr-json #213

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

Merged
merged 58 commits into from
May 12, 2025

Conversation

leighmcculloch
Copy link
Member

What

Add handling for 64-bit integers in XDR structures to ensure they are serialized as strings in JSON. Adds the handling in the cases of struct fields, union (enum) fields, and typedef (unamed struct) fields.

Why

JavaScript has limited precision for integers larger than 53 bits, requiring large integers to be represented as strings to prevent data loss. Today those integers are rendered as numbers which requires that folks use non-native JSON parsers in JavaScript runtimes.

Close #181

@leighmcculloch leighmcculloch changed the title Serialize 64-bit integers as strings in xdr-json Rust: Serialize 64-bit integers as strings in xdr-json May 8, 2025
@leighmcculloch leighmcculloch marked this pull request as ready for review May 8, 2025 02:02
@leighmcculloch leighmcculloch requested a review from dmkozh May 12, 2025 20:25
@leighmcculloch leighmcculloch enabled auto-merge (squash) May 12, 2025 20:33
@leighmcculloch leighmcculloch merged commit f36dbac into master May 12, 2025
5 checks passed
@leighmcculloch leighmcculloch deleted the 64bitintstr branch May 12, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xdrjson: Rust: Render 64-bit integers as strings
2 participants