You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"bytes""encoding/json""fmt""math/big"
gojson "github.com/goccy/go-json"
)
funcmain() {
a:=big.NewInt(123567890)
fori:=0; i<6; i++ {
a=a.Mul(a, a)
}
buf:= bytes.Buffer{}
enc:=json.NewEncoder(&buf)
iferr:=enc.Encode(a); err!=nil {
fmt.Println("failed to encode standard lib, err:", err)
return
}
fmt.Println("Standard library OK")
buf= bytes.Buffer{}
encGo:=gojson.NewEncoder(&buf)
iferr:=encGo.Encode(a); err!=nil {
fmt.Println("failed to encode gojson, err:", err)
}
}
Standard library OK
failed to encode gojson, err: json: error calling MarshalJSON for type *big.Int: strconv.ParseFloat: parsing "76200948414809119462531517826850960536131686363643267779709124660654187935282503001491794421771859987339009662441641350849331462938930835750824029814149852045881073085880629334064792752258111170220340054386254402830248902603478625028789666943107329593265071439381436119961510836736786097741991680557441102980977291137567585278607104182762284525606679219639314814207975210733462121321620125633045954506623680366327265258003639207705816681123566475526950410000000000000000000000000000000000000000000000000000000000000000": value out of range
The text was updated successfully, but these errors were encountered:
big.Int values are incorrectly encoded:
The text was updated successfully, but these errors were encountered: