Fix negative values smaller than zero
This commit is contained in:
parent
f09a2a4ca7
commit
3c1d83d8a2
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user