mirror of
https://github.com/json-iterator/go.git
synced 2025-01-23 18:54:21 +02:00
24 lines
393 B
Go
24 lines
393 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"reflect"
|
||
|
|
||
|
jsoniter "github.com/json-iterator/go"
|
||
|
)
|
||
|
|
||
|
type T struct {
|
||
|
F *float64
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
var obj T
|
||
|
|
||
|
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))
|
||
|
}
|
||
|
}
|