...
|
...
|
@@ -3,6 +3,7 @@ package utils |
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"strings"
|
|
|
"testing"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -61,13 +62,21 @@ func TestMergeMap(t *testing.T) { |
|
|
}
|
|
|
|
|
|
func TestIntUnmarsh(t *testing.T) {
|
|
|
jsonString := `{"id":8242051651122944}`
|
|
|
jsonString := `{"id":117605700954227712}`
|
|
|
type param struct {
|
|
|
Id int `json:"id"`
|
|
|
Id interface{} `json:"id"`
|
|
|
}
|
|
|
var p param
|
|
|
json.Unmarshal([]byte(jsonString), &p)
|
|
|
t.Log(p)
|
|
|
jsonByte, _ := json.Marshal(p)
|
|
|
t.Log(string(jsonByte))
|
|
|
|
|
|
decoder := json.NewDecoder(strings.NewReader(jsonString))
|
|
|
decoder.UseNumber()
|
|
|
var p2 param
|
|
|
decoder.Decode(&p2)
|
|
|
t.Log(p2)
|
|
|
jsonByte2, _ := json.Marshal(p2)
|
|
|
t.Log(string(jsonByte2))
|
|
|
} |
...
|
...
|
|