diff --git a/postgres/numeric.go b/postgres/numeric.go index b5079c2..3d477b6 100644 --- a/postgres/numeric.go +++ b/postgres/numeric.go @@ -120,6 +120,9 @@ func (n Numeric) MarshalJSON() ([]byte, error) { split := length - exp bytesWithSeparator = append(bytesWithSeparator, bytes[:split]...) + if split == 1 && n.Int.Int64() < 0 { + bytesWithSeparator = append(bytesWithSeparator, byte('0')) + } bytesWithSeparator = append(bytesWithSeparator, byte('.')) bytesWithSeparator = append(bytesWithSeparator, bytes[split:]...) return bytesWithSeparator, nil