Re: [Json] Limitations on number size?

Jacob Davies <> Tue, 09 July 2013 23:49 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 37C5C11E80D3 for <>; Tue, 9 Jul 2013 16:49:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.978
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id bNXKDd+T8zZo for <>; Tue, 9 Jul 2013 16:49:45 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:400d:c01::234]) by (Postfix) with ESMTP id 9FA8D21F9CAE for <>; Tue, 9 Jul 2013 16:49:45 -0700 (PDT)
Received: by with SMTP id a1so3341491qcx.39 for <>; Tue, 09 Jul 2013 16:49:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=9AIwXaJL9cmx/xut70++tbbV4BNfKc/bMpLVoJZZcek=; b=IcvR0wQQwuv+32oUNe1RHZIJN3V79omhyGHFuQ5vqzzbMmZDxAlTv19C4ZYodWuBWi Ux0msjduonsCAu1if48q7A8O5e5FJsV4K31G7hxL/z82OVdcoXk57pUZZ/U44wBDkY11 oCAyaaMz4s5XHqecqmFmmmr5yC0X4ww4MDA2cHT1DAe+bT3zWaWBgEX2B2e1U/xAFbSd 9a6EWpXtX1kY4ktZFe/cHqXE1h7sov+vJ/AzE+vsnwyD2AM5I0nSuCKrBKgmdCm0Oe3x Bl6i/72MDVvnCylwIIGQR/IMph6GoboB4FwOfkJjWJV7wYEfaPEnVOGK91bv7C9CU5mH rHVg==
X-Received: by with SMTP id i2mr26170713qas.11.1373413785130; Tue, 09 Jul 2013 16:49:45 -0700 (PDT)
MIME-Version: 1.0
Received: by with HTTP; Tue, 9 Jul 2013 16:49:25 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <> <> <>
From: Jacob Davies <>
Date: Tue, 9 Jul 2013 16:49:25 -0700
X-Google-Sender-Auth: iZqPTxHNkx52zuoqMLCJ1_NFG80
Message-ID: <>
To: "Peter F. Patel-Schneider" <>
Content-Type: text/plain; charset=ISO-8859-1
Cc: Nico Williams <>, Bjoern Hoehrmann <>, Tatu Saloranta <>, "" <>
Subject: Re: [Json] Limitations on number size?
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 09 Jul 2013 23:49:46 -0000

On Tue, Jul 9, 2013 at 3:58 PM, Peter F. Patel-Schneider
<> wrote:
> The only suitable guidance provided in RFC4627 is via ECMAScript and
> ECMAScript is firmly IEEE floating point double only.
> So why are you surprised that I came up with this conclusion?

What I found surprising was that there appeared to be lots of people
willing to say that the strings in the JSON data model (not the
format) are Unicode, or that the keys in the objects must be unique
according to one particular method of string normalization, but not
that the numbers in JSON are derived from Javascript and that
interoperability in the most important use of JSON (sending data to
browsers) absolutely requires you to stay within the size limit of
Javascript numbers (and failure to do so has led to some notable bugs
that require backwards-incompatible API changes, i.e. going from
number -> string for some field).

My take prior to this discussion was that the mild annoyance of not
being able to send 9223372036854775807 as a number in JSON was the
reasonable price you paid for having an interoperable number range in
the format. It seemed like most people here disagreed with my
impression, which is fair enough, and it sounded like Douglas
Crockford's intent was not to restrict them in such a way, but I would
be surprised if many people actually - intentionally at least! - use
numbers from outside the Javascript range in JSON, given the problems
it causes for Javascript.

As for numbers smaller than that range, the RFC says implementations
may reject numbers they don't like, so an implementation without
floating point numbers is OK, just not capable of general