Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73138 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12314 invoked from network); 13 Mar 2014 23:37:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Mar 2014 23:37:59 -0000 Authentication-Results: pb1.pair.com header.from=marco@m-s-d.eu; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=marco@m-s-d.eu; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain m-s-d.eu from 209.85.213.177 cause and error) X-PHP-List-Original-Sender: marco@m-s-d.eu X-Host-Fingerprint: 209.85.213.177 mail-ig0-f177.google.com Received: from [209.85.213.177] ([209.85.213.177:64534] helo=mail-ig0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/2C-47923-55142235 for ; Thu, 13 Mar 2014 18:37:58 -0500 Received: by mail-ig0-f177.google.com with SMTP id ur14so3778552igb.4 for ; Thu, 13 Mar 2014 16:37:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=fq9Ohzgh5E1To5avmqen2B5oqy+sA2NmKgKr3HGl0/w=; b=ASYFLnmPBFHuI3913wLe0M6EWOWVIGr1StujPTNetjcntNi3XZdOeqZDD3j8zFGKQI oM2B0MVddHuK3Ewr9tHRIKDEKJ3s4Rx8OEPRqwTEA/n00nla1KmOhwSTuAwMT6et2jpl i8H9osWWwGo9tGmXy8lT9GybGxFw36cs4S4pVhEVC1g6xkWRjNbSMLpwx/ExW9K/4lhq +Ps/O5n0Oi3yq2S71PFoYPFEtR+VwZzkmcE6XemlywHZ++ejnkmcAmHQcKhPN4yLUD5q ZvKGPXsqGKzb/qjDqVVGCILtzdsMUKjrkC8Xx8Mnfh5tS7Fg0KOnlvrsnus3eOkXidVC 7Q4w== X-Gm-Message-State: ALoCoQlKmiDFg50tou5xR3vCglHmnOPUvL97kAP2yLgvwUcCAaxf9r0dgKl0mZTBWD9Ir6C1KkpA MIME-Version: 1.0 X-Received: by 10.42.113.137 with SMTP id c9mr3683icq.90.1394753874618; Thu, 13 Mar 2014 16:37:54 -0700 (PDT) Sender: marco@m-s-d.eu Received: by 10.64.165.166 with HTTP; Thu, 13 Mar 2014 16:37:54 -0700 (PDT) X-Originating-IP: [46.128.155.165] In-Reply-To: <8C0E8F2C-4264-4B19-A9DD-67302A39F4CC@ajf.me> References: <8C0E8F2C-4264-4B19-A9DD-67302A39F4CC@ajf.me> Date: Fri, 14 Mar 2014 00:37:54 +0100 X-Google-Sender-Auth: i8bqyyAP-udF4grbs0NFsnwJOgE Message-ID: To: Andrea Faulds Cc: Jakub Zelenka , PHP internals list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] New JSON parser From: marco+php@m-s-d.eu (Marco Schuster) Hi, On Thu, Mar 13, 2014 at 11:52 PM, Andrea Faulds wrote: > > On 13 Mar 2014, at 22:37, Marco Schuster wrote: > > At least for the decoding part, it might be worth to look at the > "Improving JSON" proposal (http://bolinfest.com/essays/json.html). > tl;dr: support trailing or automatic line-end commas, //-style > comments and keys not wrapped in "s, basically extend JSON syntax to > ES5. > > I think it would be really cool if the new parser could (maybe with a > option "JSON_NO_STRICT_PARSING") implement these enhancements to ease > hand-writing of JSON files. > > > Please, I urge you *not* to implement anything except the pure JSON > standard. One of JSON=E2=80=99s great strengths is that there is only a s= ingle, > canonical JSON standard. Implementing other standards would be damaging t= o > interoperability. Nothing is set in stone, and evolution should be allowed, especially where it makes sense (trailing comma!). Also, that's why I suggested a "relaxed parsing" flag. This way, people knowing the differences can use what suits them best. (Also, IIRC there already exist polyfills to implement this syntax). > If people want nice config files, they can use PHP ;) Sure, but it's a bit uncool to keep the same stuff in two places - I'm thinking of a translation support for an app I write which supports both AJAX/template-based client rendering and a more basic, server-rendered version. Currently, I have the stuff in a PHP array which generates a JSON file with the translation upon manual rebuild. Alone the "support trailing comma" function (to ease working with version control) would give me the option of doing *everything* in JSON without manual rebuilds etc. Marco