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

24 lines
413 B
Go
Raw Normal View History

2017-06-29 07:25:19 -07:00
package main
import (
"encoding/json"
"fmt"
"reflect"
jsoniter "github.com/json-iterator/go"
)
2017-07-09 11:40:45 +08:00
type typeForTest struct {
2017-06-29 07:25:19 -07:00
F *float64
}
func main() {
2017-07-09 11:40:45 +08:00
var obj typeForTest
2017-06-29 07:25:19 -07:00
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))
}
}