Subject: [Cbor] Should encoding of JSON strings as CBOR major type 2 be explicitly prohibited?

From: Burt Harris <[email-masked]>
Date: Mon, 30 Apr 2018 20:43:48 +0000

After reading RFC 7049, it seemed apparent to me that the JSON string type would generally be encoded in CBOR as major type 3 (text string).   

However reviewing section 4.2, which is specifically about converting JSON to CBOR, nowhere does this rule seem stated explicitly.   I would normally not have considered this a problem, but I encountered examples in one of the tag definition documents <http://cbor.schmorp.de/stringref> uses where the author seems to interpret the RFC as saying that CBOR major type 2 (byte string) may be used as an alternative.  

Take for example, the 3-charactar JSON content "1" (with quotes included in the JSON.)     I've been surprised about how adamant the other author has been that this may be encoded as 41 31, when it seemed clear to me that 61 31 was the canonical encoding.   

I therefor wonder if it might be a good idea to add language to the CBOR bis document saying that JSON strings should always be encoded as CBOR major type 3, and that in general major type 2 would be unexpected in the result of a JSON to CBOR translation.