summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Tanous <etanous@nvidia.com>2026-02-10 20:21:21 +0300
committerEd Tanous <ed@tanous.net>2026-03-31 21:53:59 +0300
commitd4073bd32f3efe46d406fdfe538b022e1ca89570 (patch)
tree51b42a2bb00c134cb7d527d894af520153d5eda9 /include
parent93632d60d2e23d099af9dc32d4796da6d8b732d5 (diff)
downloadbmcweb-d4073bd32f3efe46d406fdfe538b022e1ca89570.tar.xz
Port nlohmann::json::parse uses to sax
We should have a single entry point where we do json parsing. There are configurations for nlohmmann that we had previously documented, but were not well enforced. Move all uses to using the helper parse functions. Tested: Unit tests pass. Redfish service validator passes. Change-Id: I2a8aed9327b6b15219dc9b4d6db146b69bcd8eb3 Signed-off-by: Ed Tanous <etanous@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/persistent_data.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index 410698c9ea..51b77465d9 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -7,6 +7,7 @@
#include "ossl_random.hpp"
#include "sessions.hpp"
// NOLINTNEXTLINE(misc-include-cleaner)
+#include "parsing.hpp"
#include "utility.hpp"
#include <boost/beast/core/file_base.hpp>
@@ -96,15 +97,15 @@ class ConfigFile
return;
}
// call with exceptions disabled
- auto data = nlohmann::json::parse(str, nullptr, false);
- if (data.is_discarded())
+ std::optional<nlohmann::json> data = parseStringAsJson(str);
+ if (!data)
{
BMCWEB_LOG_ERROR("Error parsing persistent data in json file.");
}
else
{
const nlohmann::json::object_t* obj =
- data.get_ptr<nlohmann::json::object_t*>();
+ data->get_ptr<nlohmann::json::object_t*>();
if (obj == nullptr)
{
return;