Re: [Json] JSON and int64s - any change in current best practice since I-JSON

Tim Bray <tbray@textuality.com> Tue, 16 January 2024 15:11 UTC

Return-Path: <tbray@textuality.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 5D5E4C14F5E3 for <json@ietfa.amsl.com>; Tue, 16 Jan 2024 07:11:15 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=textuality.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yx6aPMJhSJtR for <json@ietfa.amsl.com>; Tue, 16 Jan 2024 07:11:11 -0800 (PST)
Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A2C0AC14F5E2 for <json@ietf.org>; Tue, 16 Jan 2024 07:11:11 -0800 (PST)
Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-55783b7b47aso10602126a12.0 for <json@ietf.org>; Tue, 16 Jan 2024 07:11:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=textuality.com; s=google; t=1705417870; x=1706022670; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pF29soamBRKdNHnxL1koP9MZNDImbE+OtlE98Kb3ZHk=; b=fP8XIyBm95n7326M419I69GrMk7E7m3qbA5fC2BLhqKkKBagznOj2Um3cE2lxW5xQq LitGGmgIn2W4YpdviYHoZceiC8u5fkoZFwANMvLr4Gd+7jp+hV1jarnpfqubXQrnv0kd Rois8+ufzsaO/Z+aZBBUVCmkTAbwB8jN1O7wA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705417870; x=1706022670; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pF29soamBRKdNHnxL1koP9MZNDImbE+OtlE98Kb3ZHk=; b=lUpsiQEfs4fJApF17oSfHbCxPln20IZAbHJ2/wQU1kn7P0ot/B94sH+ujMivXxe+5i qYGCIRJ+4cx3BHWRizVFtuglaDqJCupJcbPZFcksW2i3+AzKlWK6FOwEQs/oxkTy6S1Q v9dNLm21aruf2yx7c7IpkrRcffuVMfYoUdVeJ158p2EUPwK/k/84yP+r4e48B8y3lz63 8jrdeEwteGBA1JGLscWHkJL3JAz4wqBaQHY1cbOkzmM9eG2jqD2NMWJXtJlU6Iw37paq qVoll7aQFgCTEopAN/7XI0i4i9WAT9audOfrHoMy0sk0q6tXfXh2gAKpI7hj+tmTDox+ 9Dhw==
X-Gm-Message-State: AOJu0YzyCzNTaG7IOdUkMOYZ1Lms6ZmCClcFXbkY8tSpP51mx91myfss 9lB2RVDQMj6DOJn1cx9UkAepTAE4kVg49KZLrQllLEs179WfyA==
X-Google-Smtp-Source: AGHT+IHMETs0JwPLVGwVEg12WG2qZ2Md+DqtkH7qk3AxnEwwG2gb5WUot608LRKFcZSQd7IRr3vpHRSoKD4F5Za/DA4=
X-Received: by 2002:aa7:d648:0:b0:559:aefc:9cee with SMTP id v8-20020aa7d648000000b00559aefc9ceemr444489edr.59.1705417869837; Tue, 16 Jan 2024 07:11:09 -0800 (PST)
Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Tue, 16 Jan 2024 10:11:08 -0500
Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Tue, 16 Jan 2024 10:11:05 -0500
MIME-Version: 1.0 (Mimestream 1.2.3)
References: <87527a42-aaac-4f39-b320-05f18a2808c1@codalogic.com> <C31BF4C8-9E6C-48F8-BF7B-D2C379273B3F@tzi.org>
In-Reply-To: <C31BF4C8-9E6C-48F8-BF7B-D2C379273B3F@tzi.org>
From: Tim Bray <tbray@textuality.com>
Date: Tue, 16 Jan 2024 10:11:08 -0500
Message-ID: <CAHBU6it4SaLawSiBgK9ySkbxjtHE6CX-P3r=hzcVy4ksoQo-Cg@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: "json@ietf.org" <json@ietf.org>, Pete Cordell <petejson@codalogic.com>
Content-Type: multipart/alternative; boundary="00000000000053593f060f118aaa"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/JQdwwrhZTjPbpR-R4Rx3M-QYKx0>
Subject: Re: [Json] JSON and int64s - any change in current best practice since I-JSON
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.39
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: <https://mailarchive.ietf.org/arch/browse/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: Tue, 16 Jan 2024 15:11:15 -0000

 Carsten is right. You probably wouldn’t use JSON if you weren’t likely to
be interchanging it with other parties over the network, other parties you
don’t control.  For quite a while, it has been quite likely that the other
parties use JavaScript, and the limits I-JSON places on numbers are a
result of this fact. This fact isn’t going away AFAIK.

On Jan 16, 2024 at 6:22:31 AM, Carsten Bormann <cabo@tzi.org> wrote:

> Hi Pete,
>
> On 2024-01-16, at 14:46, Pete Cordell <petejson@codalogic.com> wrote:
>
>
> Hi All,
>
>
> In I-JSON it recommends encoding 64-bit values using a string because many
> parsers (in particular browsers) always represent numbers using floating
> point doubles.
>
>
> (many parsers == JavaScript’s JSON.parse)
>
> We're over 8 years on from I-JSON and browsers now support things like
> BigInt.
>
>
> I’d say the problem wasn’t so much the absence of BigInt, but the fact
> that JavaScript’s JSON.parse always parses JSON numbers as a JavaScript
> Number, which is exact only inside (-2**53, 2**53).
>
> Therefore, I'd be interested to hear if there is any community change of
> opinion on how 64-bit ints should be handled in JSON.
>
>
> I think we’d first need wide support for a new equivalent to JSON.parse in
> JavaScript.
>
> Grüße, Carsten
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>