I realize that PHP does not support unsigned integers, but I’m wondering how to solve this issue I’m having with json_decode(). When I decode JSON that contains unsigned ints above 2^31, they come out negative, since they are being treated as signed ints. Is this something I can rectify by configuring my php.ini file or is there just something about json_decode that I’m not getting?
Share
The development version of PHP seems to have a planned option to
json_decode()exactly for this problem:JSON_BIGINT_AS_STRING(see Example #5 in the manual) but there seems to be no production fix for this right now.See also this comment in the user contributed notes.
Any chance of outputting strings on the encoding end somehow?