Re: [Json] JSON for Internet messages

Nico Williams <nico@cryptonector.com> Wed, 03 July 2013 17:28 UTC

Return-Path: <nico@cryptonector.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5C39911E80F2 for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 10:28:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.944
X-Spam-Level:
X-Spam-Status: No, score=-1.944 tagged_above=-999 required=5 tests=[AWL=0.033, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kflAXMnrgTHv for <json@ietfa.amsl.com>; Wed, 3 Jul 2013 10:28:46 -0700 (PDT)
Received: from homiemail-a74.g.dreamhost.com (caiajhbdcahe.dreamhost.com [208.97.132.74]) by ietfa.amsl.com (Postfix) with ESMTP id 823A911E80E9 for <json@ietf.org>; Wed, 3 Jul 2013 10:28:46 -0700 (PDT)
Received: from homiemail-a74.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a74.g.dreamhost.com (Postfix) with ESMTP id AFE4067C014 for <json@ietf.org>; Wed, 3 Jul 2013 10:28:44 -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:content-transfer-encoding; s= cryptonector.com; bh=Jz4E6g785dE8fltuUWGaJS50ez4=; b=hSBmEdQZUe/ +cCz0ZeIGfo+bkkoB2xYU2uoNYN8qKT2hgTNnqH5GinVMRxgA10kJvP2wQRk6xcN rWr0R1836UBYl2c055X2ySGTmb6hROahU7+LWuXaZgBlhC9ygX4H5dtm29VOnai/ XHzW1fTA1tSXV3dIRcxb9Srv/qhWyMyc=
Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by homiemail-a74.g.dreamhost.com (Postfix) with ESMTPSA id 6371867C06D for <json@ietf.org>; Wed, 3 Jul 2013 10:28:44 -0700 (PDT)
Received: by mail-wg0-f48.google.com with SMTP id f11so359385wgh.15 for <json@ietf.org>; Wed, 03 Jul 2013 10:28:43 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=75awCIKcbpSvIJBmPt+JyAkoKiOIg0tP+yCzK2Uou4Q=; b=gGHW9COAUUcXmmPQzS9tep+X6JZlHc6V6mnxsyP+pNv3+DxzxNnfWi8e0TPY4n3ghP ncAWbmctZfLy1r5Xbtas+b07mWNrrxRRxTe7pTVmfV16832HZ2cP0HFYi11ljfeXdGdl show9F7ZGnZwWmXQDdzn5HEEWKlNeS4bezekkQNHU9aJU5/XwxFvHDtFJS4BotmXJALJ HAfb3XTMNRn2Mcs4rAx/0aax3w5xwWNDmLmDltDSUqliIAU4lFFSecHybtIuUxbdkAr5 7tAkm8MJlUmejQ2WCCWFT60+2S3XCLLZ8x/BRy6lciPfHIbvcqrrwf3jzV3yIzLL8gaD negg==
MIME-Version: 1.0
X-Received: by 10.194.7.137 with SMTP id j9mr1315439wja.11.1372872522987; Wed, 03 Jul 2013 10:28:42 -0700 (PDT)
Received: by 10.216.152.73 with HTTP; Wed, 3 Jul 2013 10:28:42 -0700 (PDT)
In-Reply-To: <CAHBU6it55C5vCNLBki1LvjpWd4fANY8LdC4fzxj3a2G_+q=qSA@mail.gmail.com>
References: <CAHBU6it55C5vCNLBki1LvjpWd4fANY8LdC4fzxj3a2G_+q=qSA@mail.gmail.com>
Date: Wed, 03 Jul 2013 12:28:42 -0500
Message-ID: <CAK3OfOgHfc+Jbp2smq=D_woUV_ZQ3rm2bzG8-bPjXRJiLuMxSg@mail.gmail.com>
From: Nico Williams <nico@cryptonector.com>
To: Tim Bray <tbray@textuality.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Cc: "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] JSON for Internet messages
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
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: Wed, 03 Jul 2013 17:28:51 -0000

On Wed, Jul 3, 2013 at 11:34 AM, Tim Bray <tbray@textuality.com> wrote:
> So I care a lot about JSON, but I don’t care in the slightest about usages
> where the JSON isn’t being used for application-level message protocol
> payloads (are there such usages?  I'm curious).  Also, I’ve never
> encountered a scenario where the messages were of sufficient size that
> anyone gave a rat’s ass about streaming.

Er, I work with an application where I need to atomically read *all*
the data (it's ok if it's slow) once, then poll for / subscribe to an
incremental update feed.  The first requirement has devolved into
doing a single GET with chunked data results -- pagination failed
because we couldn't get the application in question to provide
atomicity with pagination.

That data comes to me as JSON.  It can be huge.  It happens to be an
array of relatively small objects, so it's possible to implement the
generation (and parsing) in a streaming way for the top-level value
and still prevent / deal with duplicate names one level down.

But you can see how one can end up needing streaming generators and parsers.

I could write a parser that streams the array and doesn't stream the
objects.  But I'm going to use an off-the-shelf parser as much as
possible.  The pressure to use a streaming parser (and generator) will
increase as the dataset increases in size.  My fear is that the cost
of dealing with this dataset will increase superlinearly with dataset
size if I use a non-streaming parser; I fear that eventually I won't
be able to use a non-streaming parser at all.

For all other purposes the application in question uses small enough
JSON documents that I wouldn't need streaming anything.

Now, in this application it just so happens that there are other ways
to guarantee non-duplicate names that are already in place, so the use
of a streaming generator/parser that does nothing about duplicate
names would be just fine.

I don't mind saying "MUST NOT" have dups.  I just want the text
written in such a way that this application can use JSON after all.
For me that would mean that it's OK to have streaming generators and
parsers, as long as the application makes sure there's no dups in that
case.

Nico
--