Re: [PHP-DEV] JSON float number as string

2015-04-16 Thread Jakub Zelenka
Hi, On Tue, Apr 14, 2015 at 7:33 AM, Alexey Zakhlestin wrote: > > > On 14 Apr 2015, at 07:31, Alexey Zakhlestin wrote: > > > > Feels a bit hackish > > I think it is possible to introduce an overall better solution > > > > We can expose result of json-tokenizing as a tree of objects: > > > > JSO

Re: [PHP-DEV] JSON float number as string

2015-04-13 Thread Alexey Zakhlestin
> On 14 Apr 2015, at 07:31, Alexey Zakhlestin wrote: > > Feels a bit hackish > I think it is possible to introduce an overall better solution > > We can expose result of json-tokenizing as a tree of objects: > > JSON\Object > JSON\Array > JSON\String > JSON\Number > JSON\False > JSON\True > JS

Re: [PHP-DEV] JSON float number as string

2015-04-13 Thread Alexey Zakhlestin
> On 29 Mar 2015, at 22:33, Jakub Zelenka wrote: > > I would like to add a new option to JSON for dealing with large floats. The > use case is mainly for decoder but can be used for encoder as well. > > JSON_FLOAT_AS_STRING > decode: all float values will be decoded as string > - It's often an

Re: [PHP-DEV] JSON float number as string

2015-04-10 Thread Yasuo Ohgaki
Hi Jakub, On Sat, Apr 11, 2015 at 1:37 AM, Jakub Zelenka wrote: > On Fri, Apr 10, 2015 at 1:29 AM, Yasuo Ohgaki 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

Re: [PHP-DEV] JSON float number as string

2015-04-01 Thread Stanislav Malyshev
Hi! > The encoding was just about re-using it. I wouldn't probably propose > such constant if it was just for encoding (the main purpose is decoding > though). I just thought that it could be a good idea to have some usage > for encoder if it's added. It seemed to me better than just ignore it > c

Re: [PHP-DEV] JSON float number as string

2015-04-01 Thread Jakub Zelenka
Hi Yasuo, On Wed, Apr 1, 2015 at 3:30 AM, Yasuo Ohgaki wrote: > > There are too many options (4 options to be exact) for JSON to work safely > under HTML context currently. If user would not like to loose int/float > information, 6 options are needed. Number of options are better to be > reduced,

Re: [PHP-DEV] JSON float number as string

2015-04-01 Thread Jakub Zelenka
Hi Stas On Wed, Apr 1, 2015 at 7:58 AM, Stanislav Malyshev wrote: > > > > encode: all float values will be encoded as string > > - re-using the constant for encoder makes sense if PHP creates JSON for > > platform that support lower float type (e.g. C float) and the precision > > loss is not acce

Re: [PHP-DEV] JSON float number as string

2015-03-31 Thread Stanislav Malyshev
Hi! > JSON_FLOAT_AS_STRING > decode: all float values will be decoded as string > - It's often an issue for very large float values with many fractional > digits that are coming from platforms that support larger float > representation than double. In that case the conversion is lost and there > i

Re: [PHP-DEV] JSON float number as string

2015-03-31 Thread Yasuo Ohgaki
Hi Jakub, On Mon, Mar 30, 2015 at 5:45 PM, Jakub Zelenka wrote: > On Mon, Mar 30, 2015 at 1:07 AM, Yasuo Ohgaki wrote: >> >> "int" should be fixed also. >> http://3v4l.org/95dHM >> >> > We have already fix for this: JSON_BIGINT_AS_STRING ( > http://3v4l.org/vYXUk ) > Excellent. > > >> So opt

Re: [PHP-DEV] JSON float number as string

2015-03-30 Thread Jakub Zelenka
On Mon, Mar 30, 2015 at 9:04 AM, Yasuo Ohgaki wrote: > Hi Pierre, > > On Mon, Mar 30, 2015 at 11:42 AM, Pierre Joye > wrote: > >> On Mon, Mar 30, 2015 at 9:14 AM, Yasuo Ohgaki wrote: >> > Hi Pierre, >> > >> > On Mon, Mar 30, 2015 at 10:54 AM, Pierre Joye >> wrote: >> >> >> >> Same effects but

Re: [PHP-DEV] JSON float number as string

2015-03-30 Thread Jakub Zelenka
Hi Yasuo On Mon, Mar 30, 2015 at 1:07 AM, Yasuo Ohgaki wrote: > > "int" should be fixed also. > http://3v4l.org/95dHM > > We have already fix for this: JSON_BIGINT_AS_STRING ( http://3v4l.org/vYXUk ) > So option may be JSON_SCALAR_AS_STRING or > additional JSON_INT_AS_STRING. > > I was actually

Re: [PHP-DEV] JSON float number as string

2015-03-30 Thread Yasuo Ohgaki
Hi Pierre, On Mon, Mar 30, 2015 at 11:42 AM, Pierre Joye wrote: > On Mon, Mar 30, 2015 at 9:14 AM, Yasuo Ohgaki wrote: > > Hi Pierre, > > > > On Mon, Mar 30, 2015 at 10:54 AM, Pierre Joye > wrote: > >> > >> Same effects but totally unrelated topics. All functions dealing with > >> large extern

Re: [PHP-DEV] JSON float number as string

2015-03-29 Thread Pierre Joye
On Mon, Mar 30, 2015 at 9:14 AM, Yasuo Ohgaki wrote: > Hi Pierre, > > On Mon, Mar 30, 2015 at 10:54 AM, Pierre Joye wrote: >> >> Same effects but totally unrelated topics. All functions dealing with >> large external numbers had the same issues, since ever. It has nothing >> to do with STH. > > >

Re: [PHP-DEV] JSON float number as string

2015-03-29 Thread Yasuo Ohgaki
Hi Pierre, On Mon, Mar 30, 2015 at 10:54 AM, Pierre Joye wrote: > Same effects but totally unrelated topics. All functions dealing with > large external numbers had the same issues, since ever. It has nothing > to do with STH. > Yes, it is. Developers make casting mistakes like this even when t

Re: [PHP-DEV] JSON float number as string

2015-03-29 Thread Pierre Joye
On Mon, Mar 30, 2015 at 8:25 AM, Yasuo Ohgaki wrote: > Hi all, > > On Mon, Mar 30, 2015 at 9:07 AM, Yasuo Ohgaki wrote: > >> Hi Jakub, >> >> On Mon, Mar 30, 2015 at 4:33 AM, Jakub Zelenka wrote: >> >>> I would like to add a new option to JSON for dealing with large floats. >>> The >>> use case i

Re: [PHP-DEV] JSON float number as string

2015-03-29 Thread Yasuo Ohgaki
Hi all, On Mon, Mar 30, 2015 at 9:07 AM, Yasuo Ohgaki wrote: > Hi Jakub, > > On Mon, Mar 30, 2015 at 4:33 AM, Jakub Zelenka wrote: > >> I would like to add a new option to JSON for dealing with large floats. >> The >> use case is mainly for decoder but can be used for encoder as well. >> >> JSO

Re: [PHP-DEV] JSON float number as string

2015-03-29 Thread Yasuo Ohgaki
Hi Jakub, On Mon, Mar 30, 2015 at 4:33 AM, Jakub Zelenka wrote: > I would like to add a new option to JSON for dealing with large floats. The > use case is mainly for decoder but can be used for encoder as well. > > JSON_FLOAT_AS_STRING > decode: all float values will be decoded as string > - It