Re: [Json] serializing sequences of JSON values

"Martin J. Dürst" <> Fri, 14 March 2014 03:03 UTC

Return-Path: <>
Received: from localhost ( []) by (Postfix) with ESMTP id ED2D61A0853 for <>; Thu, 13 Mar 2014 20:03:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.338
X-Spam-Status: No, score=-1.338 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_JP=1.244, HOST_EQ_JP=1.265, J_CHICKENPOX_74=0.6, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.547] autolearn=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id WYnQRyc4Phn1 for <>; Thu, 13 Mar 2014 20:03:02 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 597971A0700 for <>; Thu, 13 Mar 2014 20:03:01 -0700 (PDT)
Received: from ([]) by (secret/secret) with SMTP id s2E32mnF002390; Fri, 14 Mar 2014 12:02:48 +0900
Received: from (unknown []) by with smtp id 712a_ae3d_1fcc70d4_ab25_11e3_991c_001e6722eec2; Fri, 14 Mar 2014 12:02:48 +0900
Received: from [IPv6:::1] (unknown []) by (Postfix) with ESMTP id 37BFCC042B; Fri, 14 Mar 2014 12:02:48 +0900 (JST)
Message-ID: <>
Date: Fri, 14 Mar 2014 12:02:39 +0900
From: =?UTF-8?B?Ik1hcnRpbiBKLiBEw7xyc3Qi?= <>
Organization: Aoyama Gakuin University
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: Matt Miller <>, "" <>
References: <em2c025504-6532-4513-a339-3d71c4cdfbda@helsinki> <> <> <>
In-Reply-To: <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [Json] serializing sequences of JSON values
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 14 Mar 2014 03:03:04 -0000

Hello Matt,

On 2014/03/14 07:23, Matt Miller wrote:
> 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).

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.

Regards,   Martin.