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)))