bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42733: 27.1; json-serialize doesn't not encode list like json-encode


From: Lars Ingebrigtsen
Subject: bug#42733: 27.1; json-serialize doesn't not encode list like json-encode
Date: Sat, 12 Jun 2021 14:53:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]