Re: [Json] serializing sequences of JSON values

Nico Williams <nico@cryptonector.com> Tue, 11 March 2014 00:48 UTC

Return-Path: <nico@cryptonector.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 904231A0672 for <json@ietfa.amsl.com>; Mon, 10 Mar 2014 17:48:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.044
X-Spam-Level:
X-Spam-Status: No, score=-1.044 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, IP_NOT_FRIENDLY=0.334] autolearn=no
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 gMMaak3HzwlJ for <json@ietfa.amsl.com>; Mon, 10 Mar 2014 17:48:42 -0700 (PDT)
Received: from homiemail-a55.g.dreamhost.com (agjbgdcfdbgj.dreamhost.com [69.163.253.169]) by ietfa.amsl.com (Postfix) with ESMTP id 919291A0670 for <json@ietf.org>; Mon, 10 Mar 2014 17:48:42 -0700 (PDT)
Received: from homiemail-a55.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a55.g.dreamhost.com (Postfix) with ESMTP id 39F9A1604 for <json@ietf.org>; Mon, 10 Mar 2014 17:48:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=cryptonector.com; bh=iEfmGvc0sb1a5enzSZCp uuQo4bY=; b=REv8qTwhAiA69h9ogVz2Viplx7PDvjs4xLc0fWoMxdllirkRWZ1v u9iaocuJwctbi99dwJxMZzgD5YhF8BJcOPgMXHD66X/STTpA9h+T7XHKS1n4blgh Jh+rDgmlO6aesf1GuuXjdzjsCeSOe/40i0NayXkvCFGRnMUZFtx18uQ=
Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a55.g.dreamhost.com (Postfix) with ESMTPSA id D90271600 for <json@ietf.org>; Mon, 10 Mar 2014 17:48:36 -0700 (PDT)
Received: by mail-we0-f176.google.com with SMTP id x48so9251701wes.7 for <json@ietf.org>; Mon, 10 Mar 2014 17:48:35 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=45Hq82RQUcCg2YzFRIr0zuis6C3NOLcjhDqwwLvhyvw=; b=gcm7EIcZJsZI5JZ6BY+gxAhtUWNkvPJGq27OY51bsXJqCacgWrmMvjHIw5apzpdlKs hOqe5sJUKWrOuhCgkCsLHTdh+yOnTV97Vl8c25URxG2hHDNKsxZ1RA/mtiZuHa+EbZH+ w8UaxYsn3UreYLfJO3E/7vALEHTmBWm1RWevqneKJNTVW/OHX3a3oPxwqsqtidEhQMey x/33l/d/riU8qKUq6S43SlBDRO56gniQQYQcxSS062XYDuE2dkYNxloWdIC734p3DNyE OMG+RENo1L8yOEkn9VSfRDyHo0ZqPDe7ZdPBe+IRHUst0FSEYfGB8H+HJ8G9kkaNBUKm LcHQ==
MIME-Version: 1.0
X-Received: by 10.180.97.72 with SMTP id dy8mr645555wib.5.1394498915589; Mon, 10 Mar 2014 17:48:35 -0700 (PDT)
Received: by 10.216.199.6 with HTTP; Mon, 10 Mar 2014 17:48:35 -0700 (PDT)
In-Reply-To: <20140310225901.GA6673@schmorp.de>
References: <c19534113ff9489abcc4402fae3c1f62@BL2PR02MB307.namprd02.prod.outlook.com> <CAK3OfOigDS2CizGAtdRaQWbSgiJqw0Ogi-TPkWv35GjPB=CQGw@mail.gmail.com> <CAO1wJ5SLFoUSGoyM4WZa+r2Sf1A_-9e1DmUtRQqfx0UT77VXTA@mail.gmail.com> <20140310225901.GA6673@schmorp.de>
Date: Mon, 10 Mar 2014 19:48:35 -0500
Message-ID: <CAK3OfOiBWoKkZ+hBfMxgxkUt9CruNYp=Qk4Y-e_T0VeaoaVRmw@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: Marc Lehmann <schmorp@schmorp.de>
Content-Type: text/plain; charset=UTF-8
Archived-At: http://mailarchive.ietf.org/arch/msg/json/7L5hTa2oRsW93sxRwbsw3sc83Qk
Cc: "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: Tue, 11 Mar 2014 00:48:43 -0000

On Mon, Mar 10, 2014 at 5:59 PM, Marc Lehmann <schmorp@schmorp.de> wrote:
> As an implementer (with JSON::XS, which so precisely followed the spec
> that it found at least one bug in the official testsuite btw.), I am now
> in a fairly bad situation - silently switch to the new JSON format and
> push the problem to the users, or force them to enable the new version
> manually. JSON::XS did support the "new JSON" format via a switch as an
> extension, but applications had to explicitly ask for it, so presumably
> know what they are dealing with.

Hmm, no.  No one is forcing any parser or any JSON-using app to handle
non-array/object JSON text sequences if it didn't before.

The only problem I see is the need to disambiguate some cases (see
separate thread), which IMO is best done by always emitting a newline
after every JSON text.

Every parser I've worked with has an option to parse things other than
arrays/objects at the top-level, and every encoder I've ever seen has
an option for compact output (i.e., no newlines).  Given just that and
a convention of emitting a newline after every text then it's
trivially easy to build an application that unambiguously handles
sequences of JSON texts encoding any value type at the top-level.
(It's a bit trickier if the encoder has no option to emit "compact"
texts, since then one might need a parser that can consume inputs
incrementally.)

Nico
--