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
Optional. In the form of a period . followed by a required positive decimal digit sequence. The default precision is 6. Not all conversions support precision.
Conversion
Character
Precision
Description
s
N
bool
The value is formatted as true or false.
int
The value is formatted in base 10 with a preceding - if the value is negative. Insignificant 0s must be excluded.
uint
The value is formatted in base 10. Insignificant 0s must be excluded.
double
The value is formatted in base 10. Insignificant 0s must be excluded. If there are no significant digits after the . then it must be excluded.
bytes
The value is formatted as if string(value) was performed and any invalid UTF-8 sequences are replaced with \ufffd. Multiple adjacent invalid UTF-8 sequences must be replaced with a single \ufffd.
string
The value is included as is.
duration
The value is formatted as decimal seconds as if the value was converted to double and then formatted as %ds.
timestamp
The value is formatted according to RFC 3339 and is always in UTC.
null_type
The value is formatted as null.
type
The value is formatted as a string.
list
The value is formatted as if each element was formatted as "%s".format([element]), joined together with , and enclosed with [ and ].
map
The value is formatted as if each entry was formatted as "%s: %s".format([key, value]), sorted by the formatted keys in ascending order, joined together with , , and enclosed with { and }.
d
N
int
The value is formatted in base 10 with a preceding - if the value is negative. Insignificant 0s must be excluded.
uint
The value is formatted in base 10. Insignificant 0s must be excluded.
f
Y
intuintdouble: The value is converted to the style [-]dddddd.dddddd where there is at least one digit before the decimal and exactly precision digits after the decimal. If precision is 0, then the decimal is excluded. The value is rounded to the specified precision using the "round half to even" method (banker's rounding), where values exactly halfway between two numbers are rounded to the nearest even digit.
e
Y
intuintdouble: The value is converted to the style [-]d.dddddde±dd where there is one digit before the decimal and precision digits after the decimal followed by e, then the plus or minus, and then two digits.
xX
N
Values are formatted in base 16. For x lowercase letters are used. For X uppercase letters are used.
intuint
The value is formatted in base 16 with no insignificant digits. If the value was negative - is prepended.
string
The value is formatted as if bytes(value) was used to convert the string to bytes and then each byte is formatted in base 16 with exactly 2 digits.
bytes
The value is formatted as if each byte is formatted in base 16 with exactly 2 digits.
o
N
intuint: The value is converted to base 8 with no insignificant digits. If the value was negative - is prepended.
b
N
intuintbool: The value is converted to base 2 with no insignificant digits. If the value was negative - is prepended.
In all cases where double is accepted: if the value is NaN the result is NaN, if the value is infinity the result is [-]Infinity.