You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, when decimal is output as a string (for example, in JSON), zeros are truncated from it (2.00 -> 2, 3.11 -> 3.11, 13.000 -> 13). But this logic can be changed by this variable.
For example, if you have numeric(10,2) values stored in your database, and you want your API response to always be given 2 decimal places (even 2.00, 3.00, 17.00 [not 2,3,17]), then this variable is a great way out.
The text was updated successfully, but these errors were encountered:
About
As default
.String()
trunc zeroes:1.00 -> "1"
2.00 -> "2"
If we set
MarshalJSONWithoutQuotes = false
, in JSON we'll get:I think we need to add varibale
StringTrimTrailingZeros
, because in.String()
true contsant:Need:
Like a
MarshalJSONWithoutQuotes
var:Motivation
By default, when decimal is output as a string (for example, in JSON), zeros are truncated from it (2.00 -> 2, 3.11 -> 3.11, 13.000 -> 13). But this logic can be changed by this variable.
For example, if you have numeric(10,2) values stored in your database, and you want your API response to always be given 2 decimal places (even 2.00, 3.00, 17.00 [not 2,3,17]), then this variable is a great way out.
The text was updated successfully, but these errors were encountered: