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

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

bug#34242: 26.1; json-encode crudely rejects unwelcome objects


From: Lars Ingebrigtsen
Subject: bug#34242: 26.1; json-encode crudely rejects unwelcome objects
Date: Tue, 09 Jul 2019 19:42:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

phs <address@hidden> writes:

> json-encode is supposed to return a JSON representation of its argument.
>
> It fails on some objects:
>
>   (setq debug-on-error t)
>   (require 'json)
>
>   (json-encode (list (list 1)))
>
>   ==> Debugger entered--Lisp error: (json-key-format 1)
>
>   (json-encode (list (cons (cons 'a 'b) 'a)))
>
>   ==> Debugger entered--Lisp error: (wrong-type-argument listp a)
>
> I understand that maybe not all objects make sense for json-encoding but
> the documentation of json-encode does not specify what is a valid
> argument, and (it seems) the package does not do it either.
>
> Also the documentation does not list the error-codes so that we could
> catch them in code.

I've now added some text to this function (and json-read) about what the
inputs, return values are and what error signals are raised to the Emacs
trunk.

-- 
(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]