From: Drew Adams <drew.adams@oracle.com>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>, 42994@debbugs.gnu.org
Subject: bug#42994: 27.1; json-serialize unable to serialize JSON values
Date: Sun, 23 Aug 2020 09:21:03 -0700 (PDT) [thread overview]
Message-ID: <e614e74d-bf5d-4016-aac5-9ef3c95d48e3@default> (raw)
In-Reply-To: <m2a6ylmtwl.fsf@gmail.com>
> 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`.
All JSON scalars are JSON values.
Whether a JSON scalar is sufficient for a document
(a JSON text) to be considered a JSON document
(aka text) depends on whether RFC 8259 is supported.
https://tools.ietf.org/html/rfc8259
When someone speaks of "a JSON", if they mean a
JSON text (aka document), then whether that RFC is
supported determines the status of a scalar value.
Prior to that RFC, and for applications/systems that
don't support it, only JSON objects and arrays need
be considered JSON texts.
Put differently, if only RFC 7159 or RFC 4627 is
supported, and not also RFC 8259, then a document
with just a scalar (which is a JSON _value_) isn't
necessarily considered a JSON document.
From RFC 8259:
A JSON text is a serialized value. Note that
certain previous specifications of JSON
constrained a JSON text to be an object or an
array. Implementations that generate only
objects or arrays where a JSON text is called
for will be interoperable in the sense that all
implementations will accept these as conforming
JSON texts.
next prev parent reply other threads:[~2020-08-23 16:21 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
2020-08-23 16:21 ` Drew Adams [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e614e74d-bf5d-4016-aac5-9ef3c95d48e3@default \
--to=drew.adams@oracle.com \
--cc=42994@debbugs.gnu.org \
--cc=wyuenho@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).