1
0
mirror of https://github.com/json-iterator/go.git synced 2025-01-23 18:54:21 +02:00
json-iterator/output_tests/marshal_fail_case.go
2017-07-09 11:40:45 +08:00

24 lines
413 B
Go

package main
import (
"encoding/json"
"fmt"
"reflect"
jsoniter "github.com/json-iterator/go"
)
type typeForTest struct {
F *float64
}
func main() {
var obj typeForTest
jb1, _ := json.Marshal(obj)
jb2, _ := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(obj)
if !reflect.DeepEqual(jb1, jb2) {
fmt.Printf("results differ:\n expected: `%s`\n got: `%s`\n", string(jb1), string(jb2))
}
}