From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Lars Ingebrigtsen <larsi@gnus.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#42733: 27.1;
 json-serialize doesn't not encode list like json-encode
Date: Sat, 12 Jun 2021 14:53:41 +0200
Message-ID: <875yyj6y7e.fsf@gnus.org>
References: <m2v9hvzaes.fsf@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="5226"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cc: 42733@debbugs.gnu.org, Philipp Stephani <phst@google.com>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 12 14:54:10 2021
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1ls39O-0001AZ-9t
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Jun 2021 14:54:10 +0200
Original-Received: from localhost ([::1]:42868 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1ls39N-0003zR-Ce
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Jun 2021 08:54:09 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33296)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1ls39H-0003z2-7X
 for bug-gnu-emacs@gnu.org; Sat, 12 Jun 2021 08:54:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:57258)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1ls39G-0000T2-M6
 for bug-gnu-emacs@gnu.org; Sat, 12 Jun 2021 08:54:03 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1ls39G-0003gx-AS
 for bug-gnu-emacs@gnu.org; Sat, 12 Jun 2021 08:54:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Lars Ingebrigtsen <larsi@gnus.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 12 Jun 2021 12:54:02 +0000
Resent-Message-ID: <handler.42733.B42733.162350243114162@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 42733
X-GNU-PR-Package: emacs
Original-Received: via spool by 42733-submit@debbugs.gnu.org id=B42733.162350243114162
 (code B ref 42733); Sat, 12 Jun 2021 12:54:02 +0000
Original-Received: (at 42733) by debbugs.gnu.org; 12 Jun 2021 12:53:51 +0000
Original-Received: from localhost ([127.0.0.1]:40568 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1ls395-0003gM-GG
 for submit@debbugs.gnu.org; Sat, 12 Jun 2021 08:53:51 -0400
Original-Received: from quimby.gnus.org ([95.216.78.240]:42230)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@gnus.org>) id 1ls394-0003g6-I3
 for 42733@debbugs.gnu.org; Sat, 12 Jun 2021 08:53:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=iLdFPQLThBCozIrf9Qg3yVg3J1x/+Q8PUVYO9fZ8jis=; b=DXHDhY1o8A/m43Yfk4EyRxsogZ
 Ae/Wa2KlYd7QO1Cu/wUt0NPAlRfHD8ZJKnosyExgCSpdh5Tu2/Ein1G2Ec3CsslA9Tnmx+XHFn4mW
 q5hXLzf/loe7nEyFSH3Su/JhKZiC4h7Xsi9ON1f8rb4RlrLkZbtYGedDvNn34g6CfCf0=;
Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@gnus.org>)
 id 1ls38w-0005qM-0s; Sat, 12 Jun 2021 14:53:44 +0200
X-Now-Playing: Colored Music's _Individual Beauty_: "Night Paradise"
In-Reply-To: <m2v9hvzaes.fsf@gmail.com> (Jimmy Yuen Ho Wong's message of "Thu, 
 06 Aug 2020 23:17:47 +0100")
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.bugs:208380
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/208380>

Jimmy Yuen Ho Wong <wyuenho@gmail.com> writes:

> (json-encode '("foo" "bar"))
> => "[\"foo\",\"bar\"]"
>
> (json-serialize '("foo" "bar"))
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp "foo")
>   json-serialize(("foo" "bar"))
>
> The potential for people to naively substitute json-encode with
> json-serialize and breaking their code is enormous. This is already
> happening in lsp-mode. Please make json-serialize behave like
> json-encode.

json.c is a lot less "DWIM" than json.el -- which I think is generally a
good idea when it comes to doing round-trips between Elisp and JSON,
because you avoid a lot of corner cases.

So I'd be inclined to just regard this as a feature, but I've added
Philipp to the CCs -- perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no