HaxeFoundation / HaxeFoundation/haxe

Float to int conversion when stringifying and parsing Json.

Open
#11,532 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

The json resulting from pretty printing a float value that is exactly an integer doesn't include any period. As a result, when parsing the json again, the same value is interpreted as an integer.

The following example illustrate the problem, but does not involve json pretty-printing or parsing.
```
class Main {
static function main() {
var v : Float = 1.0;
trace(v);
}
}
```

It would be convenient if the pretty-printer used when stringifying json always included a float signifier.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.