GNU bug report logs - #45032
26.3; json-pretty-print of JSON with dict containing 't' as a key causes error

Previous Next

Package: emacs;

Reported by: Henry Minsky <henry.minsky <at> gmail.com>

Date: Thu, 3 Dec 2020 21:40:02 UTC

Severity: normal

Tags: fixed, patch

Merged with 42545, 46174, 46811

Found in versions 24.5, 26.3, 27.1, 28.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 45032 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Henry Minsky <henry.minsky <at> gmail.com>
Cc: 45032 <at> debbugs.gnu.org
Subject: Re: bug#45032: 26.3; json-pretty-print of JSON with dict containing
 't' as a key causes error
Date: Fri, 04 Dec 2020 11:15:18 +0100
Henry Minsky <henry.minsky <at> gmail.com> writes:

> If you run M-x json-pretty-print on this buffer contents:
>
> {"t": 259}
>
> You get an error
> Bad JSON object key: t
>
> It seems like the json parser is converting the string "t" into the
> symbol t which is being treated specially?

It's unfortunate that `json-read' is being ambiguous here.

true
=> t

{"t": 259}
=> ((t . 259))

So I don't know how to fix this.  We could add another kludge -- saying
that a boolean used as an object key "obviously" should be a string
instead (when converting back to JSON)?  Opinions?

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




This bug report was last modified 4 years and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.