diff --git a/types.go b/types.go index 68d5adea..4b58fd91 100644 --- a/types.go +++ b/types.go @@ -99,7 +99,7 @@ func (n *NullString) UnmarshalJSON(b []byte) error { // UnmarshalJSON correctly deserializes a NullInt64 from JSON func (n *NullInt64) UnmarshalJSON(b []byte) error { - var s interface{} + var s json.Number if err := json.Unmarshal(b, &s); err != nil { return err } diff --git a/types_test.go b/types_test.go index eda798bf..bbc92cd7 100644 --- a/types_test.go +++ b/types_test.go @@ -12,7 +12,7 @@ import ( var ( filledRecord = nullTypedRecord{ StringVal: NewNullString("wow"), - Int64Val: NewNullInt64(42), + Int64Val: NewNullInt64(1483272000), Float64Val: NewNullFloat64(1.618), TimeVal: NewNullTime(time.Date(2009, 1, 3, 18, 15, 5, 0, time.UTC)), BoolVal: NewNullBool(true), @@ -70,7 +70,7 @@ func TestNullTypesJSON(t *testing.T) { in: &filledRecord.Int64Val, in2: filledRecord.Int64Val, out: new(NullInt64), - want: "42", + want: "1483272000", }, { in: &filledRecord.StringVal,