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
What operating system and processor architecture are you using (go env)?
big.Rat doesn't have MarshallJSON and UnmarshallJSON methods. Is this intentional?I noticed it while trying to save an object containing a big.Rat field in mongodb, field comes up empty, due to no marshalling.
What did you do?
package main
import (
"encoding/json"
"fmt"
"math/big"
)
type SomeStructure struct {
Name string
RatField big.Rat
}
func main() {
rat := big.NewRat(10, 3)
obj := SomeStructure{
Name: "Object name",
RatField: *rat,
}
result, err := json.Marshal(obj)
if err != nil {
fmt.Println(err.Error())
return
}
fmt.Printf("Json string: %s", string(result))
}
it has MarshalText/UnmarshalText if you use pointers
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
Go version
go1.21.4
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: