This isn\'t a question as it is more of a be aware. I updated an application that uses json_encode() to PHP7.1.1 and I was seeing an issue with floats being cha
It seems like the problem occurs when serialize and serialize_precision are set to different values. In my case 14 and 17 respectively. Setting them both to 14 resolved the issue, as did setting serialize_precision to -1.
The default value of serialize_precision was changed to -1 as of PHP 7.1.0 which means "an enhanced algorithm for rounding such numbers will be used". But if you are still experiencing this issue, it may be because you have a PHP config file in place from a prior version. (Maybe you kept your config file when you upgraded?)
Another thing to consider is if it makes sense to be using float values at all in your case. It may or may not make sense to use string values containing your numbers to ensure the proper number of decimal places is always retained in your JSON.