Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113239 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11520 invoked from network); 23 Feb 2021 18:58:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Feb 2021 18:58:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 441DD1804D1 for ; Tue, 23 Feb 2021 10:46:49 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 23 Feb 2021 10:46:48 -0800 (PST) Received: by mail-wm1-f46.google.com with SMTP id o82so3423001wme.1 for ; Tue, 23 Feb 2021 10:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=AAaEBrCh6tMzDwZtOYdzNHKG3eBld7KeAoW30DYuIV4=; b=s7jBEYSG2iuTLGzWuXkpIidnsvUTHmGmMRBenvrrC3hFzbdJEJrsNYaIcaKP5k66ee ftyc0bA0eOZv42ZNvlkWFrifMDVX4pfKSWcf5V+n8BXL/bJa3kUQjNKZsiWLavO22d0T DltkCvT7Bn9x5H0Pa2XQFywyynpqcgk2n+aCMXHmNyQfDukoq4y+SOKVOuGXjwgEbetF hm333EEvY+PVT6W59KSJN9B9fgGT6P6AabdHZFItqPy6ULp6czKG2OsITg+OYhDoJqMK S844gMzb/ad8LjrO9yqLSKYdbKkyhI/hY+SnLduVPsgAZXlcyX5xFWHIS9gIKqFHfIJC 1Kjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=AAaEBrCh6tMzDwZtOYdzNHKG3eBld7KeAoW30DYuIV4=; b=tOU4RiHGunK3gpn2cnEmRgFqcdq4g9ZSeELvcRLtUeqd96Ex7jb1wAdI3coKxz8IcJ Orfo8qO56UZ2j2B/hWo/dDtKp52GoobpaWVwnhv6mvSx9fs18SU8iuifjYFeyb93Yupn 0vnURPfdCVjA6IgTPfby4XwVlrxSj3VZyu441r5WlSWmfEr4yitAj3a4z2Bmui+bg2yk S4ZhDbi93f3OmzdSErfKnFwftM8uqadWS2Whp3GKcyygk8PyUI7PTi9s0amV9jsKsyGV cafUhTdnlmUtOSfwEF4O8Z7HDw2qMAy6Bqtg9Wm6rYuOIQe6/v0uzCYfYwOU/+LxnjSy y6PQ== X-Gm-Message-State: AOAM530g8KwP6Qz9wnPJG4RRIJrAFjLe73sZdM+ZaKV7bt+2xnwH/bSH 8nFhKS01YSQDpzoukXGJB0UR5HSjGZs= X-Google-Smtp-Source: ABdhPJyfzegK+DKZKxIxWYUdpbSZLuT6+uL6+qjrR0E4ePS36y33geUP6/OIYpNp1xliKJ3whi4rCA== X-Received: by 2002:a1c:e446:: with SMTP id b67mr122978wmh.65.1614106006248; Tue, 23 Feb 2021 10:46:46 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id o124sm3813564wmo.41.2021.02.23.10.46.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Feb 2021 10:46:45 -0800 (PST) To: internals@lists.php.net References: Message-ID: <780576d4-f4a3-756e-2525-9744119006e3@gmail.com> Date: Tue, 23 Feb 2021 18:46:45 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] Support JSON With Commas and Comments (JWCC) in json_decode From: rowan.collins@gmail.com (Rowan Tommins) On 23/02/2021 18:21, Pavel Djundik via internals wrote: > See https://nigeltao.github.io/blog/2021/json-with-commas-comments.html > for more information. > > It is quite common to have trailing commas in JSON, and a lot of > parsers support it. I believe this could be trivially supported by > PHP, even if you skip adding support for comments. This is certainly one of the more reasonable proposals for extended JSON I've seen - much better than throwing the kitchen sink at it like JSON5, for instance. However, as that page makes clear, there are dozens of similar proposals out there, so I'm not sold on why PHP should jump on this particular one. It's not clear who is currently using it, or if there's actually a formal definition outside that article. > Perhaps this could be disabled by default and made opt-in with a > option flag? json_decode already supports passing in options. The risk is that this opens the gate for a complex set of "quirks flags" like the referenced Wuffs library. As the article you linked says: > Wuffs has 20 JSON quirks so far. As always, there are trade-offs. They’re not free (in terms of maintenance cost) and have super-linear complexity: that file’s comments also has 12 call-outs to the subtleties of combining two particular quirks. I would really love for one of these conservative supersets of JSON to become a widely-adopted, formal standard, and would then welcome native PHP support. But unless and until that happens, I think this is too much of a minefield. Regards, -- Rowan Tommins [IMSoP]