[Cbor] Re: Tag for Number as String?

"David E. Wheeler" <david@justatheory.com> Mon, 28 April 2025 17:47 UTC

Return-Path: <david@justatheory.com>
X-Original-To: cbor@mail2.ietf.org
Delivered-To: cbor@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id 8B42F22210CB for <cbor@mail2.ietf.org>; Mon, 28 Apr 2025 10:47:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.799
X-Spam-Level:
X-Spam-Status: No, score=-2.799 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietf.org (amavisd-new); dkim=pass (2048-bit key) header.d=justatheory.com header.b="f20XbldQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.b="b3zHx0Jf"
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9c_wxjMCGg2r for <cbor@mail2.ietf.org>; Mon, 28 Apr 2025 10:47:53 -0700 (PDT)
Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id EF10D22210C3 for <cbor@ietf.org>; Mon, 28 Apr 2025 10:47:52 -0700 (PDT)
Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 8A8BA254028E; Mon, 28 Apr 2025 13:47:52 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 28 Apr 2025 13:47:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=justatheory.com; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1745862472; x= 1745948872; bh=BBzKxmFtDgSTzCSTDbnjj7dUF2amZQ425+hGQUD3U4Y=; b=f 20XbldQ3TENpChqeibXMo/V03fsLDdjZ21g9lwl+HG3/eBLbgcV7Yyxg0bciRRcE oGGLtivF6ITVw2MCHTioJJajk+tbSO/R4JjMz5g731EpM375h4Kxp2oWWSrpzZWn x8TVUCfJpQyrFpRpGD5pe6XYUnQxLRBL+neHZSDGqh6W6JiFRgw4daPRSg7nSXNX 5QhXbmpZ30UFz0vJtE8qoMR/J7QIHQqgdzseAfQtByMu24wwL31Rfa48VcRF9E7l mwHxw6qSgncUqVPKuAW+hD69E/epDnyqFT9gYTC6jeCQ+eoT0uV6tJxh0uq8wg3i pjj/DpIVY5Hbg2VMa9KxA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1745862472; x=1745948872; bh=BBzKxmFtDgSTzCSTDbnjj7dUF2amZQ425+h GQUD3U4Y=; b=b3zHx0JfuKnquy62gZDG3imTNyMQqyPoVr8Z8jRcgjyOOx6ZRRT Z/zRdlvL3NxrLXcmCNIm7UBJzV9yZjPwWXX4P1WSii8z1fdEbs5p/1zF50f5jxaX jyCC670j5u51BZWzMJgJefE8SIBp//8o01vsPIAG713qKaiNca3nQAeoBuKwOf6N 0Gm+qsWVo+G//TYqFq+a74zdEREi4sIVm/dR8o/AuRBp4/Mrbfs/D8NkMBQrjBrO Nh7AurE+wgnBQWVpkPAyWVRYjMYZQzBT5mhZdOpkj/csJmWjROOiOLM9V0HH3VfA AGicF1aiZa1W2x0F1abw96TaDh24286UT0A==
X-ME-Sender: <xms:SL8PaNRFx2jjo-OFlOR545WQOiKXyJGCtqs430ufQgmVbDmINjGc8Q> <xme:SL8PaGxP-yRusLNJAVpIp1U43a1fVKGtU2xnn7aTmHce9UkbtfZ3JzIJ1cyuRQjFG YxPk6tQ_d_10ORdFQ>
X-ME-Received: <xmr:SL8PaC0xTF9x3YJzngXEL4bofrKiO-zXycpMooPQX-Swaui_CDmtXBW8Uyr-34Rep1prZshg5xXC6Fkim38-dxWUAJk1d7XG-yhZIhe5jck>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieduheelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurheptggguffhjgffvefkfhfvofesghdtmherhhdt jeenucfhrhhomhepfdffrghvihguucfgrdcuhghhvggvlhgvrhdfuceouggrvhhiugesjh hushhtrghthhgvohhrhidrtghomheqnecuggftrfgrthhtvghrnhephffhieeitdefkeev hfehtdfgieehgfffleetjeetkeeitdeugeejgeefffffkeeinecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepuggrvhhiugesjhhushhtrghthhgv ohhrhidrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheptggsohhrsehivghtfhdrohhrghdprhgtphhtthhopegtrggsohesthiiihdr ohhrgh
X-ME-Proxy: <xmx:SL8PaFDK_qdqQ43yUna11EXj_YmRlxIu4cBBStBptw_rrC53dkfwgg> <xmx:SL8PaGjIQ49rPmboWEqWWStNDHg0nAzE2X_3XnQquBeniEWk9MWFqA> <xmx:SL8PaJpgsFacxnEyHl0UqIjabm-speOj9jQvEbQGmyrWHwdZYOlxDA> <xmx:SL8PaBgPeWzXKbEKmM5ucR3sZnAG9OOBn6q7kEs3txidoIaY5AO-Bg> <xmx:SL8PaNQyL3RRHc4ZU81Ojg9hEZkTYeHgBnebMDRB83HdhHmqQIS1HOnq>
Feedback-ID: i7c334307:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Apr 2025 13:47:52 -0400 (EDT)
Content-Type: multipart/signed; boundary="Apple-Mail=_9C581978-6569-4331-9535-DB492BF74386"; protocol="application/pgp-signature"; micalg="pgp-sha256"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\))
From: "David E. Wheeler" <david@justatheory.com>
In-Reply-To: <FA0DC658-B4A4-4EA6-8594-FC30A1F055B2@justatheory.com>
Date: Mon, 28 Apr 2025 13:47:40 -0400
Message-Id: <BB653129-A988-48DF-8D8D-544484F38FF7@justatheory.com>
References: <DF53B36D-D442-47EC-A75A-85430BF9A764@justatheory.com> <8D7052CB-E394-4C38-9EEB-A198005042FE@tzi.org> <CA7E9F9C-9165-45D4-929D-770F055834DE@justatheory.com> <FA0DC658-B4A4-4EA6-8594-FC30A1F055B2@justatheory.com>
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3826.500.181.1.5)
Message-ID-Hash: DNZXWQGW6PZXAG2VRUKWIAL2NJ6DYYPB
X-Message-ID-Hash: DNZXWQGW6PZXAG2VRUKWIAL2NJ6DYYPB
X-MailFrom: david@justatheory.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cbor.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Carsten Bormann <cabo@tzi.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [Cbor] Re: Tag for Number as String?
List-Id: "Concise Binary Object Representation (CBOR)" <cbor.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/1-3CZth-_27iz7-pnL3fKYWLZ1s>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Owner: <mailto:cbor-owner@ietf.org>
List-Post: <mailto:cbor@ietf.org>
List-Subscribe: <mailto:cbor-join@ietf.org>
List-Unsubscribe: <mailto:cbor-leave@ietf.org>

On Apr 20, 2025, at 18:18, David E. Wheeler <david@justatheory.com> wrote:

> For my use case, however, I’d like to retain the use of cbor to serialize an object (map[string]any in Go), as it’s much more compact than serialized JSON. That leaves the need for a tag to preserve numbers as strings. Would something like this be acceptable?

Or maybe I should just use 262, since it’s just outputting a byte string of the digits that represent the number. That is, when I add the previously-mentioned tag (but with 262), the hex output of `json.Number("123456")` is `d9010666313233343536`, where `d9010666` is the tag and `313233343536` is just the byte string `123456`, yes?

Best,

David