From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#42994: 27.1; json-serialize unable to serialize JSON values Date: Sun, 23 Aug 2020 09:21:03 -0700 (PDT) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28628"; mail-complaints-to="usenet@ciao.gmane.io" To: Jimmy Yuen Ho Wong , 42994@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 23 18:24:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k9smv-0007Ip-Me for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Aug 2020 18:24:09 +0200 Original-Received: from localhost ([::1]:54850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k9smu-00075B-PX for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Aug 2020 12:24:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k9smo-00074k-Qn for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2020 12:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k9smo-0001n2-HP for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2020 12:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k9smo-0006p8-Dz for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2020 12:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Aug 2020 16:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42994 X-GNU-PR-Package: emacs Original-Received: via spool by 42994-submit@debbugs.gnu.org id=B42994.159819979826181 (code B ref 42994); Sun, 23 Aug 2020 16:24:02 +0000 Original-Received: (at 42994) by debbugs.gnu.org; 23 Aug 2020 16:23:18 +0000 Original-Received: from localhost ([127.0.0.1]:54982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9sm6-0006oD-64 for submit@debbugs.gnu.org; Sun, 23 Aug 2020 12:23:18 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:51534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k9sm3-0006nu-Cj for 42994@debbugs.gnu.org; Sun, 23 Aug 2020 12:23:16 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07NGGDNn022550; Sun, 23 Aug 2020 16:23:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=wTBNvOX/NojIcitn/Yuj1KYFLizrMF2Oru0zCtHwxKQ=; b=zFYVDN2l4v9xLMsnjCJqKFHoLuH0e8hko7MluK2ybP5KnjR/4WVLRtcm9Ejh1FkNwhfh CYLCgJz09s5QUcBv8O4dgWV+P2ltSU9lBj52wuAnhgweorMAxzx0hfsTn7ZM01qZ6IpX H5IM1gwVv1iDrXt1ixT7jQ9bvLw8L7ZS/9fK3Qqo/D0VgABhBWblkouhTxlR4ummhxMV bubBlb9Jj+PWz40oLAZ32fMbyrdAzU8dl0afhr8mXv9lrrsuor2VgUqkUujWqcVgXlpp CrvOm2widTpOdFp7ATnR76Bx/2F48xKrWYF1wxKTzynccdORjoq0sFMQ4tbBz2RkGazt VA== Original-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 333cse1cba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 23 Aug 2020 16:23:09 +0000 Original-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07NGGSpk160874; Sun, 23 Aug 2020 16:21:09 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 333rtvk5m9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 23 Aug 2020 16:21:09 +0000 Original-Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 07NGL4ml023110; Sun, 23 Aug 2020 16:21:08 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5044.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9722 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008230183 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9722 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1011 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008230183 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186062 Archived-At: > According to the [JSON spec] > (https://www.json.org/json-en.html), > everything is a value and every value is a valid JSON, which means > literal string, numbers, and true, false and null are also valid JSON > values, but `json-serialize` is unable to serialize literals. This is > wrong and behaviorialy different from the elisp-based `json-encode`. All JSON scalars are JSON values. Whether a JSON scalar is sufficient for a document (a JSON text) to be considered a JSON document (aka text) depends on whether RFC 8259 is supported. https://tools.ietf.org/html/rfc8259 When someone speaks of "a JSON", if they mean a JSON text (aka document), then whether that RFC is supported determines the status of a scalar value. Prior to that RFC, and for applications/systems that don't support it, only JSON objects and arrays need be considered JSON texts. Put differently, if only RFC 7159 or RFC 4627 is supported, and not also RFC 8259, then a document with just a scalar (which is a JSON _value_) isn't necessarily considered a JSON document. >From RFC 8259: A JSON text is a serialized value. Note that certain previous specifications of JSON constrained a JSON text to be an object or an array. Implementations that generate only objects or arrays where a JSON text is called for will be interoperable in the sense that all implementations will accept these as conforming JSON texts.