From: "Marcelo Muñoz" <ma.munoz.araya@gmail.com>
To: 42545@debbugs.gnu.org
Subject: bug#42545: 28.0.50; json-pretty-print cant't handle json having "t" as a key
Date: Sun, 26 Jul 2020 02:13:09 -0400 [thread overview]
Message-ID: <CA+VWJeJs0bsJvOfXrft1Ct+tO5CXvusi6Q-_pGZJFXL2pBH8Bw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 773 bytes --]
Try to apply json-pretty-print to follow json:
{"t": 1, "key":2}
fail with the message: json-pretty-print: Bad JSON object key: t
Some research point me the problem is in the function json-encode-key,
its implementation is:
(defun json-encode-key (object)
"Return a JSON representation of OBJECT.
If the resulting JSON object isn't a valid JSON object key,
this signals `json-key-format'."
(let ((encoded (json-encode object)))
(unless (stringp (json-read-from-string encoded))
(signal 'json-key-format (list object)))
encoded))
The follow change seems to solve the problem, but I haven't had time
understand it in depth:
(defun json-encode-key (object)
"Return s string representation of a key"
(json-encode-string (symbol-name object)))
[-- Attachment #2: Type: text/html, Size: 980 bytes --]
next reply other threads:[~2020-07-26 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-26 6:13 Marcelo Muñoz [this message]
2020-07-26 10:38 ` bug#42545: 28.0.50; json-pretty-print cant't handle json having "t" as a key Basil L. Contovounesios
2021-02-11 14:20 ` Basil L. Contovounesios
2021-02-21 13:01 ` Basil L. Contovounesios
2021-02-23 1:23 ` Dmitry Gutov
2021-02-23 1:41 ` Basil L. Contovounesios
2021-02-23 12:10 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+VWJeJs0bsJvOfXrft1Ct+tO5CXvusi6Q-_pGZJFXL2pBH8Bw@mail.gmail.com \
--to=ma.munoz.araya@gmail.com \
--cc=42545@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.