We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I don't know how it names properly, but what I mean is:
type MyString string
How I hit on the problem is with json.Decoder and UseNumber.
It marshals JSON object to map[string]any, but for JSON number it uses json.Number instead of float64, that can lose some precision.
map[string]any
float64
func main() { hook := mapstructure.TextUnmarshallerHookFunc() input := json.Number("42") var target big.Int mapstructure.DecodeHookExec( hook, reflect.ValueOf(input), reflect.ValueOf(target), ) }
panic: interface conversion: interface {} is json.Number, not string github.com/mitchellh/mapstructure.TextUnmarshallerHookFunc.func1({0x4e12c0?, 0x4aeb20?}, {0x4e12c0, 0x4b0ae0}, {0x4aeb20?, 0xc000108330}) /tmp/gopath931946810/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/decode_hooks.go:274 +0x15c
https://go.dev/play/p/Ip7bWnkDK-r
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I don't know how it names properly, but what I mean is:
How I hit on the problem is with json.Decoder and UseNumber.
It marshals JSON object to
map[string]any
, but for JSON number it uses json.Number instead offloat64
, that can lose some precision.https://go.dev/play/p/Ip7bWnkDK-r
The text was updated successfully, but these errors were encountered: