Re: [Json] serializing sequences of JSON values

Matt Miller <mamille2@cisco.com> Fri, 14 March 2014 17:24 UTC

Return-Path: <mamille2@cisco.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 427611A0191 for <json@ietfa.amsl.com>; Fri, 14 Mar 2014 10:24:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.148
X-Spam-Level:
X-Spam-Status: No, score=-14.148 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, J_CHICKENPOX_74=0.6, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.547, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aJum1Dx919ye for <json@ietfa.amsl.com>; Fri, 14 Mar 2014 10:24:41 -0700 (PDT)
Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by ietfa.amsl.com (Postfix) with ESMTP id 196861A018E for <json@ietf.org>; Fri, 14 Mar 2014 10:24:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4627; q=dns/txt; s=iport; t=1394817873; x=1396027473; h=message-id:date:from:mime-version:to:subject:references: in-reply-to:content-transfer-encoding; bh=Sa7sUEhtH00vJ4gmjRE6/VUi0+Reoll1gppGp49/3Bk=; b=nJzg/N/uDROnk1jgravu1J3/tUy6Fa7TlWEmD8gphoXB0BJXwmwQjuOy NgEpkeC7N4ntvOpfa5PZeL2WR3sCWnA7BsaeCfHlzsQkBwCLaAGUEisuX 3aRpdCQqQ231R+eDXfkhRa4EifZqJyUJnPvs3NulGzF6YnGMTaysN9QYk w=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AmMJAMc6I1OtJXG9/2dsb2JhbABZDoJ4O1eDBqVrBJh9gRkWdIIlAQEBAwEjDwFFBgsLGAICBRYLAgIJAwIBAgFFBgEMBgIBARCHXQixW6I5F4EpjQs6gm+BSQEDiVGOdJIugm5eggw
X-IronPort-AV: E=Sophos;i="4.97,656,1389744000"; d="scan'208";a="310391130"
Received: from rcdn-core2-2.cisco.com ([173.37.113.189]) by rcdn-iport-5.cisco.com with ESMTP; 14 Mar 2014 17:24:33 +0000
Received: from xhc-rcd-x05.cisco.com (xhc-rcd-x05.cisco.com [173.37.183.79]) by rcdn-core2-2.cisco.com (8.14.5/8.14.5) with ESMTP id s2EHOWqV028243 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 14 Mar 2014 17:24:32 GMT
Received: from MAMILLE2-M-T03K.local (64.101.72.33) by xhc-rcd-x05.cisco.com (173.37.183.79) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 14 Mar 2014 12:24:32 -0500
Message-ID: <53233B4F.3060108@cisco.com>
Date: Fri, 14 Mar 2014 11:24:31 -0600
From: Matt Miller <mamille2@cisco.com>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: =?UTF-8?B?Ik1hcnRpbiBKLiBEw7xyc3Qi?= <duerst@it.aoyama.ac.jp>, "json@ietf.org" <json@ietf.org>
References: <em2c025504-6532-4513-a339-3d71c4cdfbda@helsinki> <5FC8412F-30E5-4F80-AB63-6715B1053098@vpnc.org> <58a4b20f768b484c94a850c4eba71ec5@BL2PR02MB307.namprd02.prod.outlook.com> <53222FFC.8070204@cisco.com> <5322714F.6080508@it.aoyama.ac.jp>
In-Reply-To: <5322714F.6080508@it.aoyama.ac.jp>
X-Enigmail-Version: 1.6
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Originating-IP: [64.101.72.33]
Archived-At: http://mailarchive.ietf.org/arch/msg/json/3aYBLyT8C1977yRVT7XRJWfdXHg
Subject: Re: [Json] serializing sequences of JSON values
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 14 Mar 2014 17:24:44 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

/me still wears no hat ...

On 3/13/14, 9:02 PM, "Martin J. Dürst" wrote:
> Hello Matt,
> 
> On 2014/03/14 07:23, Matt Miller wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
>> 
>> On 3/13/14, 3:23 PM, Larry Masinter wrote:
>>> I wonder if there is any lesson from XMPP--  which wanted 
>>> sequence-of-XML-values in an indefinite length stream -- that
>>> would apply to JSON. What would XMPP look like if it were
>>> redone in JSON instead of XML?
>>> 
>> 
>> /me exchanges JSON chair hat for XMPP enthusiast hat ...
>> 
>> If XMPP didn't exist and we instead did JMPP, it might be a
>> series of discrete objects.  However, the direction of the later
>> "XMPP over <x>" adaptations (e.g., [BOSH] and [XMPP-WS]) speak
>> toward wanting to use an existing transport that provides
>> block-oriented framing around complete structures.
>> 
>> Dealing with partial XML-like structures in XMPP has ranged from 
>> inconvenient to impractical because the vast majority of existing
>> XML software has assumed a whole XML document when parsing
>> starts.  There are few libraries that truly allow one to feed XML
>> in fits and starts and get timely output without some amount of
>> modification or preprocessing.  When the XMPP community took
>> efforts to apply XMPP over other transports, the direction has so
>> far leaned toward the whole documents that most implementations
>> expect; even though the preprocessing required is rather small,
>> the ability to re-use existing implementations without first
>> considering oft-unpublished details was a very powerful
>> motivator.
> 
> This is very valuable feedback.
> 
> As far as I understand, the problem for XMPP has at least two
> parts: 1) The XML document arrives in pieces. 2) Parsing is done in
> pieces
> 
> My understanding is that parsing in pieces is well covered by SAX 
> parsers, so that the problems essentially came from 1). But problem
> 1) doesn't apply to JSON text sequences exchanged as MIME types,
> and it doesn't apply to log files as these are rarely read, and
> when read, that could just be done with something like
>> echo ']' > json-array-close.txt cat logfile.json
>> json-array-close.txt | json-parse
> (using [pseudo-]shell syntax).
> 

There exists a number of SAX parsers that will not emit events until
they have consumed a certain amount of input or a complete XML
document, whichever is first.  The most notable that comes to mind is
in .NET, but I've also encountered some implementations in Java that
behave this way.

There are also a number of platforms where a whole-document XML parser
is available "built-in" but a SAX parser requires additional
modules/libraries/etc (or don't even exist).

JSON is it's own thing, but my experience and observation shows to me
it's not that much different than the journey XML followed.

> As for delayed exchange of multiple JSON texts, e.g. a (completely 
> hypothetical) JMPP (JSON Messaging and Presence Protocol), one
> would try to use a message-oriented transport (e.g. WebSockets) and
> then not need a concept of JSON text sequences at all.
> 

The XMPP community started with things that mimicked the "raw TCP"
model, but moved to better take advantage of the underlying transports
message-framing, and not deal with sequences at all.

Whenever the bi-annual discussion on "Jabber™ 2.0" or "XMPP 2.0" comes
up, the major discussion is about framing, so we don't repeat our
mistakes of the past.  The next incursion could very well focus on
WebSocket for that framing.

At this point, I personally just don't see a lot of value in having a
media type for JSON text sequences.  I wonder how often a
"Content-Type: application/json-sequence" (or whatever is agreed to)
will actually be encountered over the wire.  Others mile may vary, I
suppose.


- -- 
- - m&m

Matt Miller < mamille2@cisco.com >
Cisco Systems, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCgAGBQJTIztPAAoJEDWi+S0W7cO1t1kIAKqB4FJ09zCn8cZv5khKUV1X
QiH//DwOuxm13RdAHlekhbvZ/DADsppzJr/U83iGVt4S5qJMq5lXdy0GK0PzSMlm
6k46ZQHsNyiLAN4cHqKLGusJ/AJ4zQGuHjL8KA0DNWseQ7zD6p+W6vHx1tEOa3c2
PN0zHQF0M/iuz/7RN7KlIhgaw8s483PSLy3McktshQ2deEbm95iItSriCpKOVhhQ
9VplZ0FTYUg08dWcWZQ5k9fnKzmLc0T8hg4sgxE7yyCfpTI8C6Y4RdXdoqy7MEss
vdAbaUhPbf/YiSRSheqQlzbOQDph2+0SFrslwybJPjlKXjUu2inRNqzmNDWQStg=
=TjoE
-----END PGP SIGNATURE-----