Skip to content

Commit fbbbe85

Browse files
committed
fix(runtime/json): fix 'JSON::Number::str()'
1 parent e6e6916 commit fbbbe85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/json/number.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ namespace ssc::runtime::JSON {
4848
// trim trailing zeros
4949
if (decimal >= 0) {
5050
auto i = output.size() - 1;
51-
while (output[i] == '0' && i >= decimal) {
51+
while ((output[i] == '0' || output[i] == '.') && i >= decimal) {
5252
i--;
5353
}
5454

55-
return output.substr(0, i);
55+
return output.substr(0, i + 1);
5656
}
5757

5858
return output;

0 commit comments

Comments
 (0)