Re: [Json] Minus Zero

Anders Rundgren <anders.rundgren.net@gmail.com> Mon, 20 June 2016 19:23 UTC

Return-Path: <anders.rundgren.net@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 B968312D6A7 for <json@ietfa.amsl.com>; Mon, 20 Jun 2016 12:23:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lDES0PfdXn18 for <json@ietfa.amsl.com>; Mon, 20 Jun 2016 12:23:15 -0700 (PDT)
Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 152AB12D918 for <json@ietf.org>; Mon, 20 Jun 2016 12:23:13 -0700 (PDT)
Received: by mail-wm0-x229.google.com with SMTP id a66so92390993wme.0 for <json@ietf.org>; Mon, 20 Jun 2016 12:23:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=IH8pf5EcFKVtS4D6r/22U96wLMqACFVFfNWUMGqy70E=; b=f/8mF+1VGD4LpWTNEGGLuJY6Bn740nQOzriDfmsTjU/af3xBBC5bd2tNEhlUGM7+rq CzbP2TCO6ONR3EMCmqDtUbYReNRtyrvTCm423CsmoUlq3QIJ0dYKug7xygmo1xHqsDWZ zb3+LQlhcUz7wSNDsGtAUeEKy4KpCNNLKYTDOkDazKNPJPoFzJDiUDNJ+haKFWwpFkwS ong41x+6sPttjnwWiEoaX1fsG1uCUgZiMi+3jx4IFzDSy3FFVVUyU2pw7XLY9XPDUZ2O UfcsSqkPBBHoDbjEukiyPank4p7KlRXE8gmFzluw7muNgkYu9xSybVwpRJhVt4GpY1PZ bntQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=IH8pf5EcFKVtS4D6r/22U96wLMqACFVFfNWUMGqy70E=; b=TPXSdU4SyqZ/txdEiFHCZNz1FjBSgg/e0NPlwRuA0XUadZwbUf9W5T9/SCEZ/KYmj7 gvtpTDSPpT7npap5psDtq3W7wZv2eMWxQbhoLlSYt3+ACuj7zsYNwmxHCjo107dgxsbx DGx2wqxykGtqywzynmTTa6TF5EOc6iZMVxtb+wVBma3YbzGR2F1hNOjCUJwz8CBvbTX7 NKSjXt+dub0esyYfUPqIZ/0rLPgTFk/JnhAfOTqm+ChsLS1dlnDSFccc7qcqDQbTWK0D gfsnmhqV9izbYNwuJMyvuW+V8mKFBJ6Ad2CJGvNpWUUmqx1SL/ZFBjQc6XiC1qtwrglW p/Aw==
X-Gm-Message-State: ALyK8tLKl2bFm1Bzz78xYnL4yjUiUW/2KqDiodYXYR2f3KNcVJ/7HqgN+IlUaKnok6aqUA==
X-Received: by 10.194.216.33 with SMTP id on1mr15759133wjc.153.1466450591621; Mon, 20 Jun 2016 12:23:11 -0700 (PDT)
Received: from [10.11.198.98] (ip-145-11.travedsl.de. [85.233.11.145]) by smtp.googlemail.com with ESMTPSA id ag3sm24348879wjc.39.2016.06.20.12.23.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Jun 2016 12:23:10 -0700 (PDT)
To: Christian Zangl <coralllama@gmail.com>, "json@ietf.org" <json@ietf.org>
References: <2a7f88b9-f719-dfd8-08a9-1777833e53d8@gmail.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <e94f3bd0-1635-b2e1-c5da-9ae350ae652d@gmail.com>
Date: Mon, 20 Jun 2016 21:23:05 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
MIME-Version: 1.0
In-Reply-To: <2a7f88b9-f719-dfd8-08a9-1777833e53d8@gmail.com>
Content-Type: text/plain; charset="windows-1252"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/Bq42jN-8T_ndCwlC6pr0HZKaVJg>
Subject: Re: [Json] Minus Zero
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: Mon, 20 Jun 2016 19:23:17 -0000

On 2016-06-19 22:41, Christian Zangl wrote:
> The RFC does not mention this but most (all?) JavaScript JSON libraries
> stringify -0 as "0" (including https://github.com/douglascrockford/JSON-js).
>
> Should this be included?

Serialization is not really a part of the JSON RFC.

ECMAScript V6 (ES6) is is the only normative JSON serialization reference.
Some JSON implementations are even incompatible with ES6 even for serialization of strings!
.NET and GO are currently being updated.

Serialization of floating point numbers is another thing, currently only Chrome, Safari, Firefox, node.js-V8, and my own Java implementation seem to follow ES6.

Using ES6 there is no such thing as -0 or -0.0 during serialization since the algorithm is designed to produce the shortest correct representation which is a single zero digit.

Anders