summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils/json_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/include/utils/json_utils.hpp')
-rw-r--r--redfish-core/include/utils/json_utils.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index feb4e5460f..df0c86ebb0 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -659,21 +659,19 @@ template <typename... UnpackTypes>
bool readJsonPatch(const crow::Request& req, crow::Response& res,
std::string_view key, UnpackTypes&&... in)
{
- std::optional<nlohmann::json> jsonRequest = readJsonPatchHelper(req, res);
+ std::optional<nlohmann::json::object_t> jsonRequest =
+ readJsonPatchHelper(req, res);
if (!jsonRequest)
{
return false;
}
- nlohmann::json::object_t* object =
- jsonRequest->get_ptr<nlohmann::json::object_t*>();
- if (object == nullptr)
+ if (jsonRequest->empty())
{
- BMCWEB_LOG_DEBUG("Json value is empty");
messages::emptyJSON(res);
return false;
}
- return readJsonObject(*object, res, key,
+ return readJsonObject(*jsonRequest, res, key,
std::forward<UnpackTypes&&>(in)...);
}