boost::optional<bool> asBool(const JsonObject &json, const std::string &errorBad, Severity severity) { if (json.isBool()) { return boost::optional<bool>(json.asBool()); } return boost::none; }
boost::optional<bool> getBool(const JsonObject &json, const std::string &key, bool defaultValue, const std::string &errorBad, Severity severity) { JsonObject value = json[key]; if(value.isNull()) { return boost::optional<bool>(defaultValue); } else { if(value.isBool()) { return boost::optional<bool>(value.asBool()); } else { STADIC_LOG(severity, errorBad); } } return boost::none; }