-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String Trim Trailing Zeros bool variable #295
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: