Fix negative values smaller than zero
This commit is contained in:
1 parent
f09a2a4ca7
commit
3c1d83d8a2
1 file changed
+3
@@ -120,6 +120,9 @@ func (n Numeric) MarshalJSON() ([]byte, error) {
|
|||||||
|
|
||||||
split := length - exp
|
split := length - exp
|
||||||
bytesWithSeparator = append(bytesWithSeparator, bytes[:split]...)
|
bytesWithSeparator = append(bytesWithSeparator, bytes[:split]...)
|
||||||
|
if split == 1 && n.Int.Int64() < 0 {
|
||||||
|
bytesWithSeparator = append(bytesWithSeparator, byte('0'))
|
||||||
|
}
|
||||||
bytesWithSeparator = append(bytesWithSeparator, byte('.'))
|
bytesWithSeparator = append(bytesWithSeparator, byte('.'))
|
||||||
bytesWithSeparator = append(bytesWithSeparator, bytes[split:]...)
|
bytesWithSeparator = append(bytesWithSeparator, bytes[split:]...)
|
||||||
return bytesWithSeparator, nil
|
return bytesWithSeparator, nil
|
||||||
|
|||||||
Reference in new issue
Block a user