Re: [Json] Canonicalization

Francis Galiegue <fgaliegue@gmail.com> Wed, 20 February 2013 23:05 UTC

Return-Path: <fgaliegue@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 D91C921F86E7 for <json@ietfa.amsl.com>; Wed, 20 Feb 2013 15:05:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Level:
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qy07Ma9bb1Ex for <json@ietfa.amsl.com>; Wed, 20 Feb 2013 15:05:57 -0800 (PST)
Received: from mail-ea0-f172.google.com (mail-ea0-f172.google.com [209.85.215.172]) by ietfa.amsl.com (Postfix) with ESMTP id 7701B21E8030 for <json@ietf.org>; Wed, 20 Feb 2013 15:05:57 -0800 (PST)
Received: by mail-ea0-f172.google.com with SMTP id f13so3694024eaa.31 for <json@ietf.org>; Wed, 20 Feb 2013 15:05:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=hfKYQ1M7VkEjrWu75cIxjgJn1nJEAQ9Pk/wMu7r47vY=; b=I5BANjfW7+D9rmIhIBlnf5f1KnWOHyl/7wVHASbJZv7bBsIkEJ2ibVxJSWbSNsuJv7 QyaXiWmEd00f2ba7jkqWao4qM0hiqb/I81GM09h184BSPmpe/F1XKOIufKLkAb+jgzOr IDaXXFxcjh0tfeTxrirEFcG7Gk3nCaiZqC6VjvzEjwH6zrgYy0nEG08Zt7PqW3VWHki+ +WORAAYNmNfbDgWYuBHm4nJnC2gtPnU32LFRRW8bjFkKyg6Lf/Ld6jm49qAYIShIA5nm P66PSIHHp5dc82DqPofaPlFhMvD0fCf/eN8x/2RlHOp2SatRyu0POiObyt+SVbZIjZpz iqTw==
MIME-Version: 1.0
X-Received: by 10.14.175.129 with SMTP id z1mr74450848eel.7.1361401551332; Wed, 20 Feb 2013 15:05:51 -0800 (PST)
Received: by 10.14.1.7 with HTTP; Wed, 20 Feb 2013 15:05:50 -0800 (PST)
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E11507634C37@WSMSG3153V.srv.dir.telstra.com>
References: <BF7E36B9C495A6468E8EC573603ED9411513E818@xmb-aln-x11.cisco.com> <A723FC6ECC552A4D8C8249D9E07425A70F897263@xmb-rcd-x10.cisco.com> <255B9BB34FB7D647A506DC292726F6E11507579808@WSMSG3153V.srv.dir.telstra.com> <255B9BB34FB7D647A506DC292726F6E11507634C37@WSMSG3153V.srv.dir.telstra.com>
Date: Thu, 21 Feb 2013 00:05:50 +0100
Message-ID: <CALcybBA5ED=qj-=DXMuH_2A=d3VpkRV6KM8vtu62shRxvhm+hA@mail.gmail.com>
From: Francis Galiegue <fgaliegue@gmail.com>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Cc: "draft-staykov-hu-json-canonical-form@tools.ietf.org" <draft-staykov-hu-json-canonical-form@tools.ietf.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Canonicalization
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Discussion related to JavaScript Object Notation \(JSON\)." <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, 20 Feb 2013 23:05:59 -0000

On Wed, Feb 20, 2013 at 11:58 PM, Manger, James H
<James.H.Manger@team.telstra.com> wrote:
> Canonicalization (c14n) may be a dirty word, and barred from the charter, but I hope it isn't too inappropriate to still discuss it on this email list.
>
> There is a better c14n format for numbers than I or draft-staykov-hu-json-canonical-form have suggested: it is the format produced by JSON.stringify, as defined in ECMAScript v5.1 [http://www.ecma-international.org/ecma-262/5.1/#sec-15.12.3]. Examples: 0, 1, -1000, 0.00002334, 1500000, 6.022e+23, 9.1e-28.
>
> In fact, c14n for JSON can (and should) be simply defined as per JSON.stringify, with two extra constraints: object name/value pairs are sorted; and \uxxxx escapes use lowercase hex digits (a-f). Done. Developers even have a readily available reference implementations simply by typing JSON.stringify(...) into the JavaScript console of their browser.
>

Not done. By saying that it should be done as per JSON.stringify(),
you basically preclude the use of JSON for languages which _do_ have
the ability to represent numbers outside of IEEE 754, and that
includes numbers as simple as 0.1.

It is not because ECMA 262 has made the braindead decision of limiting
numbers to IEEE 754 that JSON should follow way. RFC 4627 didn't make
that mistake and I certainly hope any IETF-related work concerning
JSON will not make such a mistake either.

-- 
Francis Galiegue, fgaliegue@gmail.com
Try out your JSON Schemas: http://json-schema-validator.herokuapp.com