Re: [Json] serializing sequences of JSON values

Tatu Saloranta <tsaloranta@gmail.com> Fri, 14 March 2014 05:27 UTC

Return-Path: <tsaloranta@gmail.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 3424C1A0040 for <json@ietfa.amsl.com>; Thu, 13 Mar 2014 22:27:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001] 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 29UNaU_bF1P9 for <json@ietfa.amsl.com>; Thu, 13 Mar 2014 22:27:15 -0700 (PDT)
Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [IPv6:2a00:1450:400c:c03::22a]) by ietfa.amsl.com (Postfix) with ESMTP id 3CAF21A003D for <json@ietf.org>; Thu, 13 Mar 2014 22:27:15 -0700 (PDT)
Received: by mail-we0-f170.google.com with SMTP id w61so1695491wes.15 for <json@ietf.org>; Thu, 13 Mar 2014 22:27:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KmYsc7FPqQmCS+XsGJfePzElrWX0SBR+JtESkwllFF0=; b=YG7wxgNLnJZBkA8JXqqTMwZGu03LrVy3p7LQB5ce3hdzZoCaoMqezLyPd9WKax9xeE GmKbbu57xADE/XLzG9w1RaPebtkOQeENuTYgWW/Qv+M4NxUoNMzDTdvMPV0KBe+/YzMl zhLyvQSyoBfET1mFcgvTK9hFvVWajczxavJCw4tfMzrJEJ5o+T8nxhK7WJHFTM7So3Fw 9XxYyowN2aW+MZR0Fx4bX5v+4IVFvO/0dTm377DlhMp55Cs308FRQ2tZnXC2xvvycbKw G1c1GGwpmdVRZz6nYvVw+5pnFRVyYSORUxiqHnG9/VrGeMFA9iWsr4+E07/gsmEqPa8V XbCw==
MIME-Version: 1.0
X-Received: by 10.194.1.242 with SMTP id 18mr4923008wjp.22.1394774828124; Thu, 13 Mar 2014 22:27:08 -0700 (PDT)
Received: by 10.227.245.10 with HTTP; Thu, 13 Mar 2014 22:27:08 -0700 (PDT)
In-Reply-To: <CAK3OfOier6uQ4nVuuCP+uWV+eRbYh8qqAi4FVdWqNLHOh94L+A@mail.gmail.com>
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> <CAGrxA26HRqa+R580qfEMXU_JGid-UDzwwmQigOkOW0OWuA9mpg@mail.gmail.com> <CAK3OfOier6uQ4nVuuCP+uWV+eRbYh8qqAi4FVdWqNLHOh94L+A@mail.gmail.com>
Date: Fri, 14 Mar 2014 05:27:08 +0000
Message-ID: <CAGrxA275TwvbUkAT7tp9NtgTDN1WwPNP33aKmAZdB7QJkSY0CA@mail.gmail.com>
From: Tatu Saloranta <tsaloranta@gmail.com>
To: Nico Williams <nico@cryptonector.com>
Content-Type: multipart/alternative; boundary=047d7b3a82142c0f2b04f48a52b5
Archived-At: http://mailarchive.ietf.org/arch/msg/json/p8sO5lIuEtM90k2aN9dQRyuMp8o
Cc: =?ISO-8859-1?Q?Martin_J=2E_D=FCrst?= <duerst@it.aoyama.ac.jp>, Matt Miller <mamille2@cisco.com>, "json@ietf.org" <json@ietf.org>
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 05:27:17 -0000

On Fri, Mar 14, 2014 at 4:21 AM, Nico Williams <nico@cryptonector.com>wrote;wrote:

> On Thu, Mar 13, 2014 at 11:04 PM, Tatu Saloranta <tsaloranta@gmail.com>
> wrote:
> > Major challenge with sequence of XML documents is really just
> implementors,
> > and inertia.
> > Having written a fully conformat XML parser that optionally supports
> > "fragment mode" (Woodstox for Java; implements SAX and Stax APIs) I can
> say
> > that compared to all other work, supporting multiple root-level
> documents is
> > a minor addition. Mode is used/useful for supporting XMPP, as well as for
> > use for streaming logging, similar to what has been discussed for JSON.
> It
> > has to be explicitly enabled (since such usage is non-compliant, having
> > multiple roots).
> >
> > There are some minor details (like xml declaration, what to do if it is
> > repeated) to deal with,
> > to allow simple concatenation, but all in all it is not a big technical
> > problem. I mean, compared to writing actual fully compliant parser
> > (supporting DTD is 80+% of the deal).
>
> By comparison, parsing a JSON text sequence can be done with any JSON
> parser, especially when the encoder is nice enough to use "compact"
> encoding options and uses newline as the separator.  To be efficient
> it's best to have an incremental parser (that is, that can be fed
> chunks of input until the end of the text is found).
>
> That's how jq handles JSON text sequences.  It's really quite simple.
>
>
Yes, absolutely. This is also one area where otherwise frustrating feature
of JSON -- requirement that linefeeds must be quoted in text values --
helps.

-+ Tatu +-