diff --git a/soft_delete.go b/soft_delete.go index f3272246..b68cee43 100644 --- a/soft_delete.go +++ b/soft_delete.go @@ -26,7 +26,10 @@ func (n DeletedAt) Value() (driver.Value, error) { } func (n DeletedAt) MarshalJSON() ([]byte, error) { - return json.Marshal(n.Time) + if n.Valid { + return json.Marshal(n.Time) + } + return json.Marshal(nil) } func (n *DeletedAt) UnmarshalJSON(b []byte) error {