New issue
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
MarshalToString "map[string]bool" get error: unexpected fault address 0xffffffffffffffff #658
Comments
go version go1.20.1 windows/amd64 has the same issue |
package main
import (
"fmt"
// jsoniter "github.com/json-iterator/go"
"encoding/json"
)
func main() {
m := map[string]interface{}{
"3": 3,
"1": 1,
"2": 2,
}
// json := jsoniter.ConfigCompatibleWithStandardLibrary
// json := jsoniter.ConfigDefault
b, err := json.Marshal(m)
fmt.Printf(">>> json : %#v\n", b)
fmt.Printf(">>> err : %#v\n", err)
} If I use "encoding/json", it works |
Same here but for regular Marshal and MarshalIndent: https://go.dev/play/p/c-ddkeoZ7Dr Go: MacOS Ventura 13.2.1: package main
import (
"fmt"
"math"
jsoniter "github.com/json-iterator/go"
)
const (
maxFloat64 = float64(math.MaxInt64)
)
func main() {
json := jsoniter.ConfigCompatibleWithStandardLibrary
m := map[string]interface{}{
"test": 42,
"max_int64": math.MaxInt64,
"max_float64": math.MaxFloat64,
"my_max_float": maxFloat64,
}
b, err := json.MarshalIndent(m, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(b))
} Sharing stacktrace for debugging:
|
The same issue happens since last year, modern-go/reflect2#26 References: |
I use the demo 100% Compatibility section in official site
The line
Json.Marshal(m)
caused error:go version go1.19.5 windows/amd64
The text was updated successfully, but these errors were encountered: