Re: [Json] serializing sequences of JSON values

Tatu Saloranta <tsaloranta@gmail.com> Sun, 09 March 2014 17:33 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 86DC71A028B for <json@ietfa.amsl.com>; Sun, 9 Mar 2014 10:33:37 -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 TrTHqA9LG54o for <json@ietfa.amsl.com>; Sun, 9 Mar 2014 10:33:35 -0700 (PDT)
Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [IPv6:2a00:1450:400c:c03::22b]) by ietfa.amsl.com (Postfix) with ESMTP id E343E1A0064 for <json@ietf.org>; Sun, 9 Mar 2014 10:33:34 -0700 (PDT)
Received: by mail-we0-f171.google.com with SMTP id t61so7437419wes.16 for <json@ietf.org>; Sun, 09 Mar 2014 10:33:29 -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=as5dik2xHhmFAP8Ym70eNaW9aILFYVWl3JAaaC+RIkA=; b=NK2AbuPuUGa5AnuTWWKzbjn1ACYy/YcF4A0epMd/Vj1vFTvaap+SGs/+v8xq1sSni+ DhMW12Wj/Vv9iFqt5eyNEJKdqkvTPyXylHf/S5LvtWHKIMz8lMtHiuNVXSh/fQwM6Ird J5yBshcYrwJUVF7jhCPYtqvGIcIU2hTfdPAzkdZDmLyR2Ie8Oz3ie3bblB/1g85jK/Gj U4ejpb3/X2gLIRK0Sfe9DqWCMADXvD1F1A/7eBSjsIbSAcWmxc6IL0SAqLdRPMiH1hVC CjlH2G0YqVHmHTZbuFGoJWAkRdWv7Z458ib8R7WMZ5CEQtHEHm9R59tK9Zt+5QtGG9rU fpGw==
MIME-Version: 1.0
X-Received: by 10.180.7.130 with SMTP id j2mr6090016wia.25.1394386409485; Sun, 09 Mar 2014 10:33:29 -0700 (PDT)
Received: by 10.227.245.10 with HTTP; Sun, 9 Mar 2014 10:33:29 -0700 (PDT)
In-Reply-To: <20140309143608.GA14656@mercury.ccil.org>
References: <c19534113ff9489abcc4402fae3c1f62@BL2PR02MB307.namprd02.prod.outlook.com> <20140309143608.GA14656@mercury.ccil.org>
Date: Sun, 09 Mar 2014 17:33:29 +0000
Message-ID: <CAGrxA27VHoxkvKH3KkFY5DTRi7a-m0F7+AiH40j8gBmK4et-fw@mail.gmail.com>
From: Tatu Saloranta <tsaloranta@gmail.com>
To: John Cowan <cowan@mercury.ccil.org>
Content-Type: multipart/alternative; boundary="f46d044287d89dfd6904f42fe2ed"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/W2WT5rprPlAlMkOltjJgduT9Z78
X-Mailman-Approved-At: Mon, 10 Mar 2014 00:55:34 -0700
Cc: Barry Leiba <barryleiba@computer.org>, Pete Resnick <presnick@qti.qualcomm.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org" <json@ietf.org>, "Paul E. Jones" <paulej@packetizer.com>, Tim Bray <tbray@textuality.com>, "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>, "Matt Miller (mamille2)" <mamille2@cisco.com>, Larry Masinter <masinter@adobe.com>, "rfc7158@schmorp.de" <rfc7158@schmorp.de>
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: Sun, 09 Mar 2014 17:33:37 -0000

The way real-life serializers do this is to keep track of state. If a root
value has been output, then insert a separator. If not, then not. Expecting
caller to pass this state would indeed be silly.

I still find it fascinating how much of discussion is based on theoretical
aspect of ifs, whys and maybes. But not in observing how things have been
done for years now.

-+ Tatu +-



On Sun, Mar 9, 2014 at 2:36 PM, John Cowan <cowan@mercury.ccil.org> wrote:

> Larry Masinter scripsit:
>
> > If you want to write out a sequence of JSON values you would write them
> out as an array with [] around and comma separators.
>
> That would be a single JSON value, not a sequence thereof.
>
> --
> Income tax, if I may be pardoned for saying so,         John Cowan
> is a tax on income.  --Lord Macnaghten (1901)           cowan@ccil.org
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>