
Vinnie Falco wrote:
So what is being discussed here is "partial CBOR support?" In other words, only the subset of CBOR that perfectly overlaps with JSON?
Well, it's self-evident that parsing a json::value from, and serializing a json::value to, CBOR, only could ever support the subset of CBOR that's representable in json::value. Fortunately, that's almost all of CBOR, because that's what CBOR is for.
(There is actually a fully compatible way to support "binary values" in json::value, but it will require some hammering out.)
Well, let's hear it!
You may remember my going on and on about arrays of scalars at one point. This is what MessagePack gets right - arrays of scalars are an important special case and stuffing them into the general value[] representation wastes both memory and performance. If json::array supported internally arrays of scalars, without changing its interface at all so it still appeared to clients as a json::array of json::values, we could represent a binary value as a json::array (which internally uses a scalar type of unsigned char.) This magically solves everything - value_to<vector<unsigned char>> works, value_from same works, it roundtrips.