Re: [Json] What is a JSON-text? [REVISITED]

Jacob Davies <jacob@well.com> Thu, 03 October 2013 19:07 UTC

Return-Path: <cromis@gmail.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 8262921F9C89 for <json@ietfa.amsl.com>; Thu, 3 Oct 2013 12:07:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, NO_RELAYS=-0.001]
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 bgDNuiYzC8KD for <json@ietfa.amsl.com>; Thu, 3 Oct 2013 12:07:17 -0700 (PDT)
Received: from mail-qc0-x232.google.com (mail-qc0-x232.google.com [IPv6:2607:f8b0:400d:c01::232]) by ietfa.amsl.com (Postfix) with ESMTP id A26D521F8934 for <json@ietf.org>; Thu, 3 Oct 2013 11:56:29 -0700 (PDT)
Received: by mail-qc0-f178.google.com with SMTP id r5so1959300qcx.9 for <json@ietf.org>; Thu, 03 Oct 2013 11:56:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=W3esNoxo59ui49nEQy0HfrWO+ExdTTly7unkyqc/+SY=; b=Z4/XPZJaQ/z7oD4dBwXV7duHDAKARB6GDtTrt35Rtt0vPKtFqA+/sgUmh01qfRcA1Q MbXe8w6/HkC82bobD7VvqBqWiiaUMbrnzZBrCu/Hk5bS6QecNucHWKJQy1A5u3kj3rvn p2vnZydeElPKB6FaT2CDHIOyQDpmaoTwqu9lRXy5qHoXS3rZcCS/jidD5Q8tXRx7EmvN MybCMvbNph6jPLubNKe4o/qKBu5s0wN/yzCENGjOro386oixJA4BqrEFx+zHEt4MDbEK zO/GRTz8UXNdUIbtp9D/X3HGngnNyUeF+mKIM0QV7Q1Bqw216zH6JTXbyuqFfoF7TWvn 7Eig==
X-Received: by 10.49.6.232 with SMTP id e8mr11839500qea.18.1380826588381; Thu, 03 Oct 2013 11:56:28 -0700 (PDT)
MIME-Version: 1.0
Sender: cromis@gmail.com
Received: by 10.49.107.3 with HTTP; Thu, 3 Oct 2013 11:56:08 -0700 (PDT)
In-Reply-To: <CAK3OfOhRCCfNWHD-qSXOmswE7DL+QFefE_pvQO5g24NJ9q07hg@mail.gmail.com>
References: <BF7E36B9C495A6468E8EC573603ED9411EF2B583@xmb-aln-x11.cisco.com> <CAHBU6iv7gT8nebFnz_mHQVZ3z8Kz+Pb8VRrSkMf44QRqWL8QjA@mail.gmail.com> <524DAEBF.1020509@drees.name> <CAK3OfOhRCCfNWHD-qSXOmswE7DL+QFefE_pvQO5g24NJ9q07hg@mail.gmail.com>
From: Jacob Davies <jacob@well.com>
Date: Thu, 03 Oct 2013 11:56:08 -0700
X-Google-Sender-Auth: wI3uf61ot__FBkEMhD-mknK3UCM
Message-ID: <CAO1wJ5TGifR2s=5L=X=hsf6vRPCgbkP8jNye9hfhVhejR+eHwQ@mail.gmail.com>
To: Nico Williams <nico@cryptonector.com>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: Tim Bray <tbray@textuality.com>, JSON WG <json@ietf.org>, "stefan@drees.name" <stefan@drees.name>, "Matt Miller (mamille2)" <mamille2@cisco.com>
Subject: Re: [Json] What is a JSON-text? [REVISITED]
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: Thu, 03 Oct 2013 19:07:24 -0000

On Thu, Oct 3, 2013 at 11:24 AM, Nico Williams <nico@cryptonector.com> wrote:
> "But JSON is an interchange format for networking" is not a good
> answer to that.  It's a good interchange format, full stop.  The train
> with JSON used for local interchange purposes left the station.  This
> is why parsers commonly have an option to accept scalar values at the
> top-level.

As I said in the last discussion: the asymmetry of a JSON document
having to be an object or an array while a JSON value can be an object
or an array or a string or a number or a boolean or null is
unintuitive and has no principled rationale. The arguments against
allowing values at top level are taste-based, not based on principle
or practice.

In the systems I work on we treat "JSON serializability" as meaning
"transformable into a JSON value". Not a JSON text. The natural
serialization for many types is a string or a number or a boolean. So,
why do I suddenly have to act differently when I am sending something
on the wire? What is the principled distinction between a JSON value
in memory and a JSON text sent over the network? Why am I supposed to
put this in an envelope just because network transport is involved?

Allowing values at the top level is not a breaking change since the
JSON spec says that implementations may reject texts they don't like.
In practice, it is widely interoperable already.