created AddReportFutureVersion dbus method

New method will support CollectionTimeScope, CollectionDuration

In order to make not breaking interface changes bmcweb will switch to
AddReportFutureVersion, then AddReport will be changed to match
AddReportFutureVersion, then redfish will switch back to use AddReport,
then AddReportFutureVersion will be removed.

Tested:
  - Verified that current version of bmcweb works fine with old API

Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I51a9b7fb2f4da5b8d2f688ccd5e93710352b1ac7
diff --git a/src/utils/json.hpp b/src/utils/json.hpp
new file mode 100644
index 0000000..2ae606f
--- /dev/null
+++ b/src/utils/json.hpp
@@ -0,0 +1,63 @@
+#pragma once
+
+#include <nlohmann/json.hpp>
+
+#include <string_view>
+
+namespace utils
+{
+
+template <class T>
+struct is_vector : std::false_type
+{};
+
+template <class T>
+struct is_vector<std::vector<T>> : std::true_type
+{};
+
+template <class T>
+constexpr bool is_vector_v = is_vector<T>::value;
+
+template <class T>
+std::optional<T> readJson(const nlohmann::json& json)
+{
+    if constexpr (is_vector_v<T>)
+    {
+        if (json.is_array())
+        {
+            auto result = T{};
+            for (const auto& item : json.items())
+            {
+                if (auto val = readJson<typename T::value_type>(item.value()))
+                {
+                    result.emplace_back(*val);
+                }
+            }
+            return result;
+        }
+    }
+    else
+    {
+        if (const T* val = json.get_ptr<const T*>())
+        {
+            return *val;
+        }
+    }
+
+    return std::nullopt;
+}
+
+template <class T>
+std::optional<T> readJson(const nlohmann::json& json, std::string_view key)
+{
+    auto it = json.find(key);
+    if (it != json.end())
+    {
+        const nlohmann::json& subJson = *it;
+        return readJson<T>(subJson);
+    }
+
+    return std::nullopt;
+}
+
+} // namespace utils