Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2020-09-16 14:28:35


On Tue, Sep 15, 2020 at 7:14 AM Rainer Deyke via Boost
<boost_at_[hidden]> wrote:
> - The omission of binary serialization formats (CBOR et al) bothers
> me. Not from a theoretical point of view, but because I have actual
> code that uses CBOR, and I won't be able to convert this code to
> Boost.JSON unless CBOR support is provided.

I've looked at the CBOR specification and some implementations in the
wild and these points stick out:

1. CBOR supports extensions, which cannot be represented in boost::json::value
2. CBOR also supports "binary" strings, which also cannot be
represented in boost::json::value
3. If boost.json's value container could hold these things, then it
would no longer serialize to standard JSON

Therefore, it seems to me that CBOR is not just a "binary
serialization format for JSON." It is in fact a completely different
format that only strongly resembles JSON. Or perhaps you could say it
is a superset of JSON. I think the best way to support this is as
follows:

1. Fork the Boost.JSON repository, rename it to Boost.CBOR
2. Add support for binary strings to the cbor::value type
3. Add support for extensions to the cbor::value type
4. Replace the parse, parser, serialize, and serializer interfaces
with CBOR equivalents
5. Propose this library as a new Boost library, with a separate review process

Then, we would have a first-class CBOR library whose interface and
implementation are optimized specifically for CBOR. Questions such as
what happens when you serialize a cbor::value to JSON would be moot.

This could be something that Krystian might take on as author and maintainer.

Thanks


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk