Boost logo

Boost :

From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2020-09-22 11:22:36


> On 21. Sep 2020, at 20:46, Vinnie Falco via Boost <boost_at_[hidden]> wrote:
>
> * Both of these use-cases are useful, and desirable
> * Most of the time, a user wants one or the other - rarely both

The point of the proponents of a serialisation solution is that it can potentially also handle the DOM case, but obviously not vice versa. We may end up in a situation where Boost.JSON is accepted, but it does not address all use-cases and so yet another library has to be written. This will lead to code duplication. Perhaps Boost.JSON could build on this hypothetical library once it is there, but are you going to change your implementation if you then have to rely on another Boost library?

> * Optimized implementations of these use-cases are unlikely to share much
> code

I think the whole parsing can be shared.

> * These are really two different libraries

I don't think so. If we can find a solution that allows one to deserialize JSON to the dynamic json::value, then this would making reading into the DOM type a special case of normal serialization. In fact, we could then even deserialize JSON into Boost.Any or std::any.

> * No one has submitted a JSON library of any kind for review to Boost *ever*
> * The most popular JSON libraries implement JSON-DOM, not JSON Serialization
> * Even one of the most popular serialization libraries,
> Boost.Serialization, does not offer a JSON archive implementation
> * Boost.Property tree supports JSON-DOM out of the box, but not JSON
> Serialization
>
> I find it interesting that people are coming out of the woodwork who claim
> to have written their own JSON libraries, that say REJECT to Boost.JSON,
> because they feel that conversion between JSON and user-defined types is of
> the utmost importance and that Boost can't have a JSON library without it.
>
> * If this is so important, why does Boost.Serialization not have it?
> * Why is no one submitting a pull request to Boost.Serialization for a JSON
> archive?
> * Why has no one proposed a library to Boost which implements JSON
> Serialization?
> * Why doesn't Boost.PropertyTree have JSON-DOM but no JSON Serialization?
> * Where are the immensely popular JSON Serialization libraries?

The reason is that some Boost libraries have been successfully cloned by outside people and the development is happening there. Boost.Python is replaced by pybind11 and Boost.Serialization by cereal.

https://github.com/USCiLab/cereal

The most obvious appeal of cereal is that it is C++11. Boost.Serialization has a lot of pre-C++11 code and is accordingly a bit difficult to work with. Both pybind11 and cereal jumped on the opportunity to rewrite popular Boost libraries in C++11.

cereal has a JSON archive. cereal also has 2.5k stars on Github, so it is dramatically popular.

Best regards,
Hans


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