Open
Description
Version: v1.1.7
Here is the code
import (
"bytes"
json2 "encoding/json"
"testing"
)
var json = jsoniter.ConfigCompatibleWithStandardLibrary
type Test struct {
Message json2.RawMessage
}
func TestJson(t *testing.T) {
test := &Test{}
test.Message = []byte("123")
data, _ := json.Marshal(test)
data2, _ := json2.Marshal(test)
if bytes.Compare(data, data2) != 0 {
t.Errorf("data: %s != data2 %s", data, data2)
}
}
output:
=== RUN TestJson
--- FAIL: TestJson (0.00s)
handler_test.go:19: data: {"Message":null} != data2 {"Message":123}
FAIL
Metadata
Metadata
Assignees
Labels
No labels