Re: JSON float number as string
| From: | Yasuo Ohgaki | Date: | Fri, 10 Apr 2015 21:59:21 +0000 |
| Subject: | Re: JSON float number as string | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85773@lists.php.net to get a copy of this message | ||
Hi Jakub,
On Sat, Apr 11, 2015 at 1:37 AM, Jakub Zelenka <bukka@php.net> wrote:
> On Fri, Apr 10, 2015 at 1:29 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>>
>> Could you add "json_encode" type hint also?
>>
>
>> Large int/float must be treated as string or GMP object (we don't have
>> GMP float yet, though)
>>
> Currently, there is no way to encode large "numeric" JSON data correctly
>> when it is stored as
>> string.
>>
>> string json_encode ( mixed $value [, int $options = 0 [, int $depth = 512
>> [, array $type_spec = NULL]]] )
>>
>> where $type_spec specifies correct data representation. i.e. numeric,
>> string, bool
>>
>> json_encode() type hint should work like Zeev's type hint.
>> i.e. No data type conversion, but validate its content.
>>
>>
> Again this is a bit off-topic. I think that it would be good if you could
> create a bug report for this. It would be great to add an example how the
> $type_spec should work (e.g. if you mean something like
> http://json-schema.org/examples.html )
>
Yes.
We need something like this to make jason_encode() work as it should.
FR is added.
https://bugs.php.net/bug.php?id=69422
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net