Subject: [Json] Proposal: JSON text sequence MIME type and Proposed Standard

From: Nico Williams <[email-masked]>
Date: Tue, 11 Mar 2014 13:20:20 -0500

I propose a new Proposed Standard and MIME type describing a "JSON
text sequence" as: a sequence of JSON texts separated by newlines.

Details:

 - the newline is REQUIRED when following any of "true", "false",
"null", or any numeric value, otherwise it is RECOMMENDED (but
optional)

 - it will be RECOMMENDED that JSON texts written to JSON text
sequences be encoded with no newlines in the encoding.

The need for a newline (or other, but here newline) separator will be
explained (namely: it's needed to disambiguate some cases).

Perhaps (if folks demand it) an option for specifying an alternate
separator in the MIME type will be provided.

That's it.

Given existing use of this, I propose that the WG take this as a work
item, updating the charter to permit it if need be.  I'd volunteer to
edit the I-D.

Nico
--

---

From: Nico Williams <[email-masked]>
Date: Tue, 11 Mar 2014 15:52:17 -0500

> "null", or any numeric value, otherwise it is RECOMMENDED (but

Just to clarify: it should be possible to build a JSON text sequence
parser given the above and any existing JSON parser, even when the
JSON texts do have embedded newlines (e.g., between array elements,
...).

The rationale for using a newline is twofold:

 - it's roughly how text-based log files tend to work;
 - there's always a "readline" primitive about that can be used to
build a JSON text sequence parser (in conjunction with a JSON parser,
of course).

And, of course, these are _texts_, so newlines help readability.

> sequences be encoded with no newlines in the encoding.

would only help implementors who lack an incremental JSON parser, but
it would only help them if this were a requirement, which it shouldn't
be, thus there's no point to this recommendation, so I'll just remove
it.

Nico
--

---

From: John Cowan <[email-masked]>
Date: Tue, 11 Mar 2014 19:08:38 -0400

> text sequence" as: a sequence of JSON texts separated by newlines.

Since a JSON text is bracketed by optional whitespace, it makes sense
to me that a JSON text sequence should be also bracketed by optional
whitespace, with the values separated by mandatory whitespace.
This is very simple.

-- 
Some people open all the Windows;       John Cowan
wise wives welcome the spring           [email-masked]
by moving the Unix.                     http://www.ccil.org/~cowan
  --ad for Unix Book Units (U.K.)
        (see http://cm.bell-labs.com/cm/cs/who/dmr/unix3image.gif)

---

From: Nico Williams <[email-masked]>
Date: Tue, 11 Mar 2014 18:48:52 -0500

> whitespace, with the values separated by mandatory whitespace.

Yes, it is.  It has the benefit of ending the perennial debate over
ambiguities created by allowing any value type at the top-level.  In
fact, no ambiguity was created except when JSON texts are expected to
be followed by anything other than EOF (which was never contemplated
by the original, IIUC).  But since "JSON text sequence" is a useful
and _used_ concept, the ambiguity issue does come up, and this is the
best resolution (IMO).

Nico
--