Skip to content

Commit bd92a7e

Browse files
authored
enable JSON_PRESERVE_ZERO_FRACTION by default
this makes json output float values that happen to be full numbers with a `.0`, so `4.0` or `0.0` instead of `4` resp `0`. that in turn helps when consuming the json in a type-safe language.
1 parent d43ee36 commit bd92a7e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Encoder/JsonEncode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class JsonEncode implements EncoderInterface
2323
public const OPTIONS = 'json_encode_options';
2424

2525
private $defaultContext = [
26-
self::OPTIONS => 0,
26+
self::OPTIONS => \JSON_PRESERVE_ZERO_FRACTION,
2727
];
2828

2929
public function __construct(array $defaultContext = [])

0 commit comments

Comments
 (0)