I have a JSON string containing some key with the following value: 123.00. When I use the json_decode function, I get a decoded string where the previous key is 123, not 123.00. Is there a way to fix the decoding of such values โโwithout using quotes?
It is currently being raised as a PHP error:
Error Report : https://bugs.php.net/bug.php?id=50224
In the future, there may be functionality for passing a flag through the options parameter for stronger typing. At this point, however, wrapping it in quotation marks will suffice.
options
I do not think that's possible!
//convert the json to a string before json_decode $res = preg_replace( '/next_cursor":(\d+)/', 'next_cursor":"\1"', $json );
number_format($number, 2)
print a number through this?
You can use the JSON_BIGINT_AS_STRING option, for example:
JSON_BIGINT_AS_STRING
$json = json_decode($input, true, 512, JSON_BIGINT_AS_STRING);
Caution, but this only works with PHP 5.4+!
Source: https://habr.com/ru/post/1435505/More articles:What is a "Walk along the path" trying to say? - goMySQL: get local time for a specific time zone - timezoneJersey path match sandbox or empty lines - javaHow to add xaml code to c # comment? - c #Java GUI programming strategy? - javaExclude set of specific numbers in regex pattern "\ d +" - regexJava NIO MappedByteBuffer OutOfMemoryException - javaIncremental buffer allocation with memory mapping and crash at 1 GB - scalaGetting current domain + directory in php - htmlrender grails tag in controller - grailsAll Articles