Subject: [apps-discuss] RFC 4627 and text vs values

From: Francis Galiegue <[email-masked]>
Date: Thu, 27 Sep 2012 14:27:40 +0200

Hello,

RFC 4627 has a disturbing feature, since it defines that a JSON text
is either an object or an array, but a JSON value can be any type. It
also says that JSON generators produce JSON text (without a MUST or
SHOULD), and that JSON parsers transform JSON texts only (without a
MUST or SHOULD either).

Essentially, does it mean that if an application, say, using HTTP, returns:

1

which is a valid JSON _value_, it violates RFC 4627?

All JSON parsers I have tried so far "correctly" parse 1, or any "non
container" value for that matter, and this seems to be in
contradiction with the RFC as well...

-- 
Francis Galiegue, [email-masked]
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)

---

From: Andrew Newton <[email-masked]>
Date: Thu, 27 Sep 2012 08:42:24 -0400

> SHOULD), and that JSON parsers transform JSON texts only (without a

Hmmm... It does appear that the first two sentences of Section 2 might
contradict each other. And the reference to the ABNF from the prose is
"JSON text" where the grammar rule is "JSON-text".

> contradiction with the RFC as well...

For what it is worth, this is one of the two differences between RFC
4627 and ECMA-262 called out by ECMAScript.

-andy

---

From: Francis Galiegue <[email-masked]>
Date: Thu, 27 Sep 2012 15:01:26 +0200

On Thu, Sep 27, 2012 at 2:42 PM, Andrew Newton <[email-masked]> wrote:
[...]
> 4627 and ECMA-262 called out by ECMAScript.

That kind of begs the question: why wouldn't it be legal to produce
JSON values other than arrays/objects? "Primitve" JSON values are
potentially useful as well, I don't see the point of forbidding their
production. This looks like limiting the expressiveness of JSON to me.

Regards,