Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86546 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1966 invoked from network); 10 Jun 2015 11:09:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2015 11:09:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.180 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.180 mail-ig0-f180.google.com Received: from [209.85.213.180] ([209.85.213.180:36614] helo=mail-ig0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/37-61871-2EA18755 for ; Wed, 10 Jun 2015 07:09:22 -0400 Received: by igbpi8 with SMTP id pi8so32630656igb.1 for ; Wed, 10 Jun 2015 04:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Yh5XMqB7y/AE2R9rq+Iiqnw/AdeizEp+IF0X2W5iU38=; b=UaNkAtOFqArd8Zdr0rsjvun1orGjPb22AuhW8bVvzDKiX6PPJvmyXMFJrI3N5w1dvG ZJ67i/LD8GLyc2PDvhEpwM0ig4ANlcQhcUx/RyFYJh7Mnift9pTTu/R+CBVETbiTzRDU 2JipdDgPmKf/kDX2FRnzgITPtRqqwIDVr6uyqOsIkkIF8a9FQCDdT8ZFzSdbT8+TWbxj /b3xC5arY0I1e5AX+XnUiUqeD1UvUZMhJYl7+YCb18nJ3TNBMZEddLvEuupY4qb3ckrd X7zKAINEJOevJIQV9fBP4PgyAdbMi8behOGhuT1Pvau0JfHYkZxfHkMs+uZULxYk4kwP x4Wg== MIME-Version: 1.0 X-Received: by 10.50.141.164 with SMTP id rp4mr27161599igb.2.1433934558904; Wed, 10 Jun 2015 04:09:18 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.107.153.74 with HTTP; Wed, 10 Jun 2015 04:09:18 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Jun 2015 12:09:18 +0100 X-Google-Sender-Auth: 068r7uaF0hgnHNYBwD1Bkdt4jDc Message-ID: To: Yasuo Ohgaki Cc: Derick Rethans , PHP internals list Content-Type: multipart/alternative; boundary=089e0129538003c67f051827e8ea Subject: Re: [PHP-DEV] [VOTE] JSON number to string From: bukka@php.net (Jakub Zelenka) --089e0129538003c67f051827e8ea Content-Type: text/plain; charset=UTF-8 Hi Yasuo, On Wed, Jun 10, 2015 at 11:57 AM, Yasuo Ohgaki wrote: > Hi Derick, > > On Wed, Jun 10, 2015 at 7:28 PM, Derick Rethans wrote: > >> > Hi, >> > >> > The voting is now open: >> > >> > https://wiki.php.net/rfc/json_numeric_as_string#voting >> >> FWIW, I voted no to all of them because (as you even say in the RFC), >> this is probably better be solved with a JSON schema thingy. > > > JSON Schema does not help to decoding/encoding numeric data without > loosing data. > > JSON Schema Core > http://json-schema.org/latest/json-schema-core.html#anchor8 > Note: JSON specification does not specify precision. So number could be > any number. > > JSON Schema Validation > http://json-schema.org/latest/json-schema-validation.html#anchor5 > > Those who do not care rounding errors/etc, they can use default behavior. > > The idea would be to use JSON schema just for selecting the type for deserialized item in decoded JSON. It means that you could for example select one float item that you want to decode as a string but other floats would be still decoded as floats. That gives a better flexibility and helps the problem in the same way. Please see my email to Alexey when we discussed this RFC (there are few examples): https://www.mail-archive.com/internals@lists.php.net/msg78698.html Cheers Jakub --089e0129538003c67f051827e8ea--