Re: [Json] Allow any JSON value at the top level

Jacob Davies <jacob@well.com> Mon, 10 June 2013 19:33 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 45BBE21F9AD2 for <json@ietfa.amsl.com>; Mon, 10 Jun 2013 12:33:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.977
X-Spam-Level:
X-Spam-Status: No, score=-2.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
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 9nxS-jUnAJS0 for <json@ietfa.amsl.com>; Mon, 10 Jun 2013 12:33:17 -0700 (PDT)
Received: from mail-qe0-f53.google.com (mail-qe0-f53.google.com [209.85.128.53]) by ietfa.amsl.com (Postfix) with ESMTP id C1ACF21F9AD3 for <json@ietf.org>; Mon, 10 Jun 2013 12:33:16 -0700 (PDT)
Received: by mail-qe0-f53.google.com with SMTP id 1so4255686qee.26 for <json@ietf.org>; Mon, 10 Jun 2013 12:33:16 -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 :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=DI+PZ7wxbaphnNOP1BZSm+8yDKTf/oTUUzuedtVGFB4=; b=1CJr7lBf2ArsExN4n1TNCU6sIawRJ4BU9TVfkxDBlYJjTS0xC964mqOpMqaNJAvJpO Hsf9sdbwrfqaBOr8vncJZtQdMTTV4u/2LG+BlVG80ns4dPrlaT0drS4fAhX5zyjXOcUy eBuxPG/T0mVXTAGXbN7exNJidJyIZL/q7Vsc4OgtPFnyiQrCBov+SSF2kWfBFWLNG7ba 0ILqFGafftxvCiMoF5N/J3uWSLBaDnM4V9tp1RIA0t+n4tovNXc0gLAkssIZ/dLEew48 oxqzQb/xFtTlsx09PssYhL7iA8Xs8pwc7aXfFaVN8T/qkNK3LYpjpBg30dMgyvhWrU2o zZ3Q==
X-Received: by 10.224.11.199 with SMTP id u7mr15119538qau.76.1370892796268; Mon, 10 Jun 2013 12:33:16 -0700 (PDT)
MIME-Version: 1.0
Sender: cromis@gmail.com
Received: by 10.49.106.228 with HTTP; Mon, 10 Jun 2013 12:32:55 -0700 (PDT)
In-Reply-To: <51b507b1.c686e00a.3a7e.ffffa0adSMTPIN_ADDED_BROKEN@mx.google.com>
References: <A723FC6ECC552A4D8C8249D9E07425A70FC33B5B@xmb-rcd-x10.cisco.com> <51b23e6d.6196420a.0b15.4245SMTPIN_ADDED_BROKEN@mx.google.com> <CAChr6SwrveU=fesF8VidDYWzeYMu2c1+=38+__BqHArxTiW5mg@mail.gmail.com> <51b4dbbe.64da440a.1fc2.6dd2SMTPIN_ADDED_BROKEN@mx.google.com> <CAChr6Sx_obmG+=sY100ySBLmevN0VJ_0Z9TjYGxcXKOx+UtnJA@mail.gmail.com> <51b4ec44.ea05420a.7c73.ffffa487SMTPIN_ADDED_BROKEN@mx.google.com> <CAChr6SxiZ2Yz6SiozQZpuYoGKSzWnUux6PukyWDkcvKsVyyRbQ@mail.gmail.com> <51b507b1.c686e00a.3a7e.ffffa0adSMTPIN_ADDED_BROKEN@mx.google.com>
From: Jacob Davies <jacob@well.com>
Date: Mon, 10 Jun 2013 12:32:55 -0700
X-Google-Sender-Auth: VwSlFKU7qIjCltKg7DpN4PRo2nc
Message-ID: <CAO1wJ5R2H27qh-DWG5B8CzutkTFWxn-h+Qi1jiet23axxmvLyA@mail.gmail.com>
To: Markus Lanthaler <markus.lanthaler@gmx.net>
Content-Type: text/plain; charset="ISO-8859-1"
Cc: "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Allow any JSON value at the top level
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: Mon, 10 Jun 2013 19:33:23 -0000

Lots of people do this, in my experience, including me pretty often.

The original specification has an asymmetry in what values may be sent
at the top level motivated by an encoding-detection scheme that is now
obsolete. Some people seem to like it because composite values are a
good idea for top-level payloads, but if that were the case one ought
to object on similar principle to any value that does not permit
further arbitrary sub-structure (like a number). Sometimes a number is
just a number. And arrays are a poor choice for arbitrarily complex
metadata anyway.

The big problem with the current requirement is that arbitrary
sub-values of a JSON value cannot be sent as application/json. So for
instance, if you wish to implement a form of PATCH on a JSON document,
you must demand that clients wrap their new value in a JSON object or
array instead of sending raw primitive values. If you implement a
service returning an inherently primitive value (e.g. a plain-text
document server) you must wrap your responses in a JSON object or
array even though there is nothing else that could reasonably be
added. A system designer might be justified in saying that every
response is an object, but the spec shouldn't dictate what is really a
matter of taste (use of in-band rather than out-of-band metadata).

On Sun, Jun 9, 2013 at 3:54 PM, Markus Lanthaler
<markus.lanthaler@gmx.net> wrote:
> On Sunday, June 09, 2013 11:06 PM, R S wrote:
>>> Why can't a separate media type, e.g., application/json-value,
>>> be defined allowing this?
>>
>> We could do that, but it might be a bit pointless. It won't change
>> the fact that primitive values are already sent as application/json.
>
> Who's doing that?
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json