The major part of this file is copied. I made only a few changes to allow serialization of std::optional and Json::Value.