Skip to content

math/big: big.Int JSON marshalling to/from string #36099

@rubensayshi

Description

@rubensayshi

big.Int by design marshalls / unmarshalls to a number in JSON but for actual BIG numbers this ends up with a mess in other languages, specially javascript ...

Now encoding/json has a ,string struct tag to flag a field to be quoted as a string instead but it's restricted only for strings, floats, integers, and booleans can be quoted. atm.
If this could also be applied to big.Int then we'd have a good solution for BIG numbers without breaking the existing functionality at all!

related; #28154
and there's probably many more people running into this issue...

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions