Re: [Json] Limitations on number size?

Jacob Davies <jacob@well.com> Wed, 05 June 2013 17:52 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 E8FF721F9BCA for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 10:52:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.977
X-Spam-Level:
X-Spam-Status: No, score=-1.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, 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 Jez+Ynw1p0tu for <json@ietfa.amsl.com>; Wed, 5 Jun 2013 10:52:28 -0700 (PDT)
Received: from mail-qa0-x233.google.com (mail-qa0-x233.google.com [IPv6:2607:f8b0:400d:c00::233]) by ietfa.amsl.com (Postfix) with ESMTP id 4452D21F9B32 for <json@ietf.org>; Wed, 5 Jun 2013 10:52:21 -0700 (PDT)
Received: by mail-qa0-f51.google.com with SMTP id i13so1332758qae.3 for <json@ietf.org>; Wed, 05 Jun 2013 10:52:19 -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:content-type; bh=eY2wIq4NupbP/A1b9PK+KNieC85nVuWqUEId3YuqM68=; b=Y5d+909qBXEaY1HKn14p01fXMH158Cq1hRjHsPu5ni7byQj4OTRI947Hvp9Hk+SLql Bxx49MV/yJvLSiAw1Shlf7PwzKRtmNg7vyoxaF4PVczQ51it0kFmGQKApmQlop3leO9C VjqyHiXl4QPs24EtUlVRM6Y90xdE3tHq8ZVVh2rOHbWr4r8yCTkltwl9E/MUwmcebsDh 53fT8OelascF2GnjnaHO0Ez4I9I7zs+L4THFKHHHZ3kedJPbh2g+RkXzaZ0m9tGYqus+ wqU76TZMZL5GzWIxeH9PnxLUP5DzLWp3yI6BPPIHl7BEGlM1b/1iJSPD9ImYjNwKLCy0 Eehg==
X-Received: by 10.229.204.4 with SMTP id fk4mr49162qcb.88.1370454738926; Wed, 05 Jun 2013 10:52:18 -0700 (PDT)
MIME-Version: 1.0
Sender: cromis@gmail.com
Received: by 10.49.106.228 with HTTP; Wed, 5 Jun 2013 10:51:58 -0700 (PDT)
In-Reply-To: <CAK3OfOgO_DgP=O-hpMRJNYicnWs9S00zY=B2xZ5tM6++RqXYig@mail.gmail.com>
References: <CAK3OfOgPGi4PKxKAGEG=PCv-xaszMqWpUUUH2B9f0UaeMMO1gQ@mail.gmail.com> <C42654A3-E218-45A8-B368-4A60CB89619D@vpnc.org> <C4D8E604-E4F8-408B-B7DD-97226300C212@tzi.org> <CAK3OfOjDp=S=HZ5LTP3L+rqq1VjhSShakmBOJD9aPiN8fSULKw@mail.gmail.com> <C30B2D0D-75A7-49A5-A190-5AD5DC1FCDCC@vpnc.org> <CAK3OfOi6uNcXLCcStg90j2LqqdyVWQeoBAd0Mad-EjFEDyixpw@mail.gmail.com> <51AE63B1.80800@crockford.com> <CAChr6Szu11Qtbc9JGrG-bNvq=SCN-f81dZ1GoH_sz+KvddE0nw@mail.gmail.com> <BF7E36B9C495A6468E8EC573603ED9411527BC7D@xmb-aln-x11.cisco.com> <CAChr6SxzAQ+MFG60foM915Za+nroo6yy=JL1N40dZsx84u6rMg@mail.gmail.com> <CAK3OfOgO_DgP=O-hpMRJNYicnWs9S00zY=B2xZ5tM6++RqXYig@mail.gmail.com>
From: Jacob Davies <jacob@well.com>
Date: Wed, 5 Jun 2013 10:51:58 -0700
X-Google-Sender-Auth: gM6bqGPy3HXdhPrFKl1IsQOoygw
Message-ID: <CAO1wJ5Qrhvr55Hba66Yy01JETrEYucf3gOXhwAu4zQTBzRkriw@mail.gmail.com>
To: "json@ietf.org" <json@ietf.org>
Content-Type: multipart/alternative; boundary=001a11c29274e5358204de6bdbbd
Subject: Re: [Json] Limitations on number size?
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, 05 Jun 2013 18:06:39 -0000

On Tue, Jun 4, 2013 at 9:05 PM, Nico Williams <nico@cryptonector.com> wrote:

> It might be nice to be able to specify some ranges that MUST be
>  supported by decoders, but in practice I think we can't (and probably
> shouldn't try to) even do that.
>

My past reading of the number section and the many references to Javascript
in the spec led me to believe that the number type was Javascript's number
type, and that compliance required you to accept & emit numbers only in
that range (i.e. IEEE 754 64-bit numbers minus NaN and infinities).

Implementation limits on the length of strings or size of arrays or objects
were not specified either, but those are large enough in most languages
that you're unlikely to run into them unexpectedly; if you are thinking of
sending a terabyte of text in string or an object with a trillion keys it
has probably occurred to you that some special interoperability concerns
will apply. But just sending large 64-bit integers as numbers in a JSON
string will cause you interoperability problems with Javascript and a lot
of other JSON parsers, and my experience & some quick searches indicate
this has been a common bug (or misunderstanding, perhaps) in
implementations.

I wouldn't say a size restriction should be specified either. But I think
it might be worth noting this particular interoperability concern in the
specification rather than just as a best practice.