diff --git a/soft_delete.go b/soft_delete.go index b68cee43..284129a1 100644 --- a/soft_delete.go +++ b/soft_delete.go @@ -33,8 +33,12 @@ func (n DeletedAt) MarshalJSON() ([]byte, error) { } func (n *DeletedAt) UnmarshalJSON(b []byte) error { + if string(b) == "null" { + n.Valid = false + return nil + } err := json.Unmarshal(b, &n.Time) - if err == nil && !n.Time.IsZero() { + if err == nil { n.Valid = true } return err