so this working good. I thinking why laravel version didn't work. Problem is that i get this value from outside api and it's returned as string. I wan't to convert this "5.00005" for float 5.00005 and this "5" to 5.0 . I don't know how many numbers is after dot so i need universal solution. This will be the best but it doesn't work and i don't know why
after run curl example.com in terminal i get {"number":8}. So not only in browsers. maybe problem is with this return and Laravel parse my json one more time?
no, cURL also uses it's own json parser.
The SO question I linked to gives a bit of explanation and a few suggestions about how to write your own JSON parser which will keep the extra decimals.
The easiest way would be to simply cast the float back into a string.
Json parsers wont touch it then.
The downside would be that the code processing this json would have to parse the string back into a float.