-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
What version of Go are you using (go version)?
$ go version go version go1.17.3
Does this issue reproduce with the latest release?
Yes
What did you do?
Try to decode json numbers in string format as big.Int.
What did you expect to see?
String number (e.g. {"val": "123"}) should be unmarshaled to big.Int.
What did you see instead?
String number (e.g. {"val": "123"}) can not be unmarshaled to big.Int.
Proposal
Even though the json spec does allow numbers of any size it is very common to have big numbers in string format, e.g. {"val": "123"} instead of {"val":123}. I propose to add support for reading numbers in string format to big.Int.UnmarshalJSON.
No API change, just a small improvement.
Related Issues: