all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 42994@debbugs.gnu.org
Subject: bug#42994: 27.1; json-serialize unable to serialize JSON values
Date: Sun, 23 Aug 2020 15:05:22 +0100	[thread overview]
Message-ID: <CAKDRQS6R4Z0FtKqN_GTJEYmWux2LjHU3g3O-EVhD5+tX-KsA2g@mail.gmail.com> (raw)
In-Reply-To: <CAKDRQS6N16Z79OzFe57x_FZUH8cCMgUPZjpkb89_Qr=FUk8+5w@mail.gmail.com>

The answer seems to be setting JSON_ENCODE_ANY and JSON_DECODE_ANY

https://jansson.readthedocs.io/en/latest/apiref.html#encoding
https://jansson.readthedocs.io/en/latest/apiref.html#decoding

On Sun, Aug 23, 2020 at 1:56 PM Jimmy Yuen Ho Wong <wyuenho@gmail.com> wrote:
>
> (json-serialize t) ;; *** Eval error ***  Wrong type argument: json-value-p, t
> (json-serialize "foo") ;; *** Eval error ***  Wrong type argument:
> json-value-p, "foo"
> (json-serialize 1) ;; *** Eval error ***  Wrong type argument: json-value-p, 1
>
> These are all valid JSONs.
>
> On Sun, Aug 23, 2020 at 1:53 PM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> > > Date: Sun, 23 Aug 2020 13:24:58 +0100
> > >
> > >
> > > According to the [JSON spec](https://www.json.org/json-en.html),
> > > everything is a value and every value is a valid JSON, which means
> > > literal string, numbers, and true, false and null are also valid JSON
> > > values, but `json-serialize` is unable to serialize literals. This is
> > > wrong and behaviorialy different from the elisp-based `json-encode`.
> >
> > Thank you for your report.  To allow us to process this issue quickly
> > and efficiently, please provide a couple of examples where
> > json-serialize is unable to serialize literals.





  reply	other threads:[~2020-08-23 14:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 12:24 bug#42994: 27.1; json-serialize unable to serialize JSON values Jimmy Yuen Ho Wong
2020-08-23 12:53 ` Eli Zaretskii
2020-08-23 12:56   ` Jimmy Yuen Ho Wong
2020-08-23 14:05     ` Jimmy Yuen Ho Wong [this message]
2020-08-23 16:21 ` Drew Adams
2020-08-23 16:46   ` Jimmy Yuen Ho Wong
2020-08-23 16:58     ` Drew Adams
2020-08-24  6:13       ` Jimmy Yuen Ho Wong
2021-02-13 13:40 ` Philipp
2021-02-13 18:23   ` Basil L. Contovounesios
2021-02-13 18:36     ` Philipp
2021-02-13 23:30     ` bug#42994: [External] : " Drew Adams
2021-02-14  0:40       ` Jimmy Yuen Ho Wong
2021-02-14 10:00         ` Philipp Stephani

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=CAKDRQS6R4Z0FtKqN_GTJEYmWux2LjHU3g3O-EVhD5+tX-KsA2g@mail.gmail.com \
    --to=wyuenho@gmail.com \
    --cc=42994@debbugs.gnu.org \
    --cc=eliz@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.