diff --git a/src/util/json/fromjson.h b/src/util/json/fromjson.h index 410d094..1729bd1 100644 --- a/src/util/json/fromjson.h +++ b/src/util/json/fromjson.h @@ -80,6 +80,26 @@ void fromJson(const Json& json, std::vector& array) }); } +template +void fromJson(const Json& json, std::map& object) +{ + assert(json.type() == Json::Type::Object); + object.clear(); + for (const auto& [name, value] : json.asObject().members()) { + object.emplace(name, value.template get()); + } +} + +template +void fromJson(const Json& json, std::unordered_map& object) +{ + assert(json.type() == Json::Type::Object); + object.clear(); + for (const auto& [name, value] : json.asObject().members()) { + object.emplace(name, value.template get()); + } +} + struct fromJsonFunction { template auto operator()(const Json& json, T&& value) const