diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 702136a..ae050ac 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -290,8 +290,7 @@
                         else if (propertyPair.first == "Nameservers")
                         {
                             const std::vector<std::string> *nameservers =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::vector<std::string>>(
+                                std::get_if<std::vector<std::string>>(
                                     &propertyPair.second);
                             if (nameservers != nullptr)
                             {
@@ -301,8 +300,7 @@
                         else if (propertyPair.first == "StaticNameServers")
                         {
                             const std::vector<std::string> *staticNameServers =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::vector<std::string>>(
+                                std::get_if<std::vector<std::string>>(
                                     &propertyPair.second);
                             if (staticNameServers != nullptr)
                             {
@@ -322,8 +320,7 @@
                         else if (propertyPair.first == "DomainName")
                         {
                             const std::vector<std::string> *domainNames =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::vector<std::string>>(
+                                std::get_if<std::vector<std::string>>(
                                     &propertyPair.second);
                             if (domainNames != nullptr)
                             {
@@ -391,8 +388,7 @@
                     if (propertyPair.first == "HostName")
                     {
                         const std::string *hostname =
-                            sdbusplus::message::variant_ns::get_if<std::string>(
-                                &propertyPair.second);
+                            std::get_if<std::string>(&propertyPair.second);
                         if (hostname != nullptr)
                         {
                             ethData.hostname = *hostname;
@@ -401,8 +397,7 @@
                     else if (propertyPair.first == "DefaultGateway")
                     {
                         const std::string *defaultGateway =
-                            sdbusplus::message::variant_ns::get_if<std::string>(
-                                &propertyPair.second);
+                            std::get_if<std::string>(&propertyPair.second);
                         if (defaultGateway != nullptr)
                         {
                             ethData.default_gateway = *defaultGateway;
@@ -411,8 +406,7 @@
                     else if (propertyPair.first == "DefaultGateway6")
                     {
                         const std::string *defaultGateway6 =
-                            sdbusplus::message::variant_ns::get_if<std::string>(
-                                &propertyPair.second);
+                            std::get_if<std::string>(&propertyPair.second);
                         if (defaultGateway6 != nullptr)
                         {
                             ethData.ipv6_default_gateway = *defaultGateway6;
diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp
index 6287f3c..910d33b 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -235,8 +235,7 @@
                         if (propertyPair.first == "HostName")
                         {
                             const std::string *hostName =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::string>(&propertyPair.second);
+                                std::get_if<std::string>(&propertyPair.second);
                             if (hostName != nullptr)
                             {
                                 ethData.hostname = *hostName;
@@ -245,8 +244,7 @@
                         else if (propertyPair.first == "DefaultGateway")
                         {
                             const std::string *defaultGateway =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::string>(&propertyPair.second);
+                                std::get_if<std::string>(&propertyPair.second);
                             if (defaultGateway != nullptr)
                             {
                                 ethData.default_gateway = *defaultGateway;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 767a7fc..77155e3 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -459,8 +459,7 @@
         if (property.first == "Timestamp")
         {
             const std::string *value =
-                sdbusplus::message::variant_ns::get_if<std::string>(
-                    &property.second);
+                std::get_if<std::string>(&property.second);
             if (value != nullptr)
             {
                 timestamp = *value;
@@ -469,8 +468,7 @@
         else if (property.first == "Filename")
         {
             const std::string *value =
-                sdbusplus::message::variant_ns::get_if<std::string>(
-                    &property.second);
+                std::get_if<std::string>(&property.second);
             if (value != nullptr)
             {
                 filename = *value;
@@ -479,8 +477,7 @@
         else if (property.first == "Log")
         {
             const std::string *value =
-                sdbusplus::message::variant_ns::get_if<std::string>(
-                    &property.second);
+                std::get_if<std::string>(&property.second);
             if (value != nullptr)
             {
                 logfile = *value;
@@ -1008,8 +1005,7 @@
                         {
                             if (propertyMap.first == "Id")
                             {
-                                id = sdbusplus::message::variant_ns::get_if<
-                                    uint32_t>(&propertyMap.second);
+                                id = std::get_if<uint32_t>(&propertyMap.second);
                                 if (id == nullptr)
                                 {
                                     messages::propertyMissing(asyncResp->res,
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index d3d9580..a2ae1ea 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -76,8 +76,7 @@
                         if (propertyPair.first == "NTPServers")
                         {
                             const std::vector<std::string>* ntpServers =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::vector<std::string>>(
+                                std::get_if<std::vector<std::string>>(
                                     &propertyPair.second);
                             if (ntpServers != nullptr)
                             {
@@ -87,8 +86,7 @@
                         else if (propertyPair.first == "DomainName")
                         {
                             const std::vector<std::string>* domainNames =
-                                sdbusplus::message::variant_ns::get_if<
-                                    std::vector<std::string>>(
+                                std::get_if<std::vector<std::string>>(
                                     &propertyPair.second);
                             if (domainNames != nullptr)
                             {
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index b963a53..33b8828 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -163,17 +163,15 @@
                     {"Name", "PCIe Device"},
                     {"Id", device}};
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Manufacturer"]);
+                if (std::string *property = std::get_if<std::string>(
+                        &pcieDevProperties["Manufacturer"]);
                     property)
                 {
                     asyncResp->res.jsonValue["Manufacturer"] = *property;
                 }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["DeviceType"]);
+                if (std::string *property = std::get_if<std::string>(
+                        &pcieDevProperties["DeviceType"]);
                     property)
                 {
                     asyncResp->res.jsonValue["DeviceType"] = *property;
@@ -264,9 +262,8 @@
                     // Check if this function exists by looking for a device ID
                     std::string devIDProperty =
                         "Function" + std::to_string(functionNum) + "DeviceId";
-                    std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties[devIDProperty]);
+                    std::string *property = std::get_if<std::string>(
+                        &pcieDevProperties[devIDProperty]);
                     if (property && !property->empty())
                     {
                         pcieFunctionList.push_back(
@@ -318,127 +315,111 @@
         const std::string &device = params[0];
         const std::string &function = params[1];
 
-        auto getPCIeDeviceCallback =
-            [asyncResp, device, function](
-                const boost::system::error_code ec,
-                boost::container::flat_map<
-                    std::string, sdbusplus::message::variant<std::string>>
-                    &pcieDevProperties) {
-                if (ec)
+        auto getPCIeDeviceCallback = [asyncResp, device, function](
+                                         const boost::system::error_code ec,
+                                         boost::container::flat_map<
+                                             std::string,
+                                             sdbusplus::message::variant<
+                                                 std::string>>
+                                             &pcieDevProperties) {
+            if (ec)
+            {
+                BMCWEB_LOG_DEBUG
+                    << "failed to get PCIe Device properties ec: " << ec.value()
+                    << ": " << ec.message();
+                if (ec.value() ==
+                    boost::system::linux_error::bad_request_descriptor)
                 {
-                    BMCWEB_LOG_DEBUG
-                        << "failed to get PCIe Device properties ec: "
-                        << ec.value() << ": " << ec.message();
-                    if (ec.value() ==
-                        boost::system::linux_error::bad_request_descriptor)
-                    {
-                        messages::resourceNotFound(asyncResp->res, "PCIeDevice",
-                                                   device);
-                    }
-                    else
-                    {
-                        messages::internalError(asyncResp->res);
-                    }
-                    return;
+                    messages::resourceNotFound(asyncResp->res, "PCIeDevice",
+                                               device);
                 }
-
-                // Check if this function exists by looking for a device ID
-                std::string devIDProperty = "Function" + function + "DeviceId";
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties[devIDProperty]);
-                    property && property->empty())
+                else
                 {
-                    messages::resourceNotFound(asyncResp->res, "PCIeFunction",
-                                               function);
-                    return;
+                    messages::internalError(asyncResp->res);
                 }
+                return;
+            }
 
-                asyncResp->res.jsonValue = {
-                    {"@odata.type", "#PCIeFunction.v1_2_0.PCIeFunction"},
-                    {"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" +
-                                      device + "/PCIeFunctions/" + function},
-                    {"Name", "PCIe Function"},
-                    {"Id", function},
-                    {"FunctionId", std::stoi(function)},
-                    {"Links",
-                     {{"PCIeDevice",
-                       {{"@odata.id",
-                         "/redfish/v1/Systems/system/PCIeDevices/" +
-                             device}}}}}};
+            // Check if this function exists by looking for a device ID
+            std::string devIDProperty = "Function" + function + "DeviceId";
+            if (std::string *property =
+                    std::get_if<std::string>(&pcieDevProperties[devIDProperty]);
+                property && property->empty())
+            {
+                messages::resourceNotFound(asyncResp->res, "PCIeFunction",
+                                           function);
+                return;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "DeviceId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["DeviceId"] = *property;
-                }
+            asyncResp->res.jsonValue = {
+                {"@odata.type", "#PCIeFunction.v1_2_0.PCIeFunction"},
+                {"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" +
+                                  device + "/PCIeFunctions/" + function},
+                {"Name", "PCIe Function"},
+                {"Id", function},
+                {"FunctionId", std::stoi(function)},
+                {"Links",
+                 {{"PCIeDevice",
+                   {{"@odata.id",
+                     "/redfish/v1/Systems/system/PCIeDevices/" + device}}}}}};
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "VendorId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["VendorId"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "DeviceId"]);
+                property)
+            {
+                asyncResp->res.jsonValue["DeviceId"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "FunctionType"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["FunctionType"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "VendorId"]);
+                property)
+            {
+                asyncResp->res.jsonValue["VendorId"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "DeviceClass"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["DeviceClass"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "FunctionType"]);
+                property)
+            {
+                asyncResp->res.jsonValue["FunctionType"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "ClassCode"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["ClassCode"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "DeviceClass"]);
+                property)
+            {
+                asyncResp->res.jsonValue["DeviceClass"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "RevisionId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["RevisionId"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "ClassCode"]);
+                property)
+            {
+                asyncResp->res.jsonValue["ClassCode"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "SubsystemId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["SubsystemId"] = *property;
-                }
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "RevisionId"]);
+                property)
+            {
+                asyncResp->res.jsonValue["RevisionId"] = *property;
+            }
 
-                if (std::string *property =
-                        sdbusplus::message::variant_ns::get_if<std::string>(
-                            &pcieDevProperties["Function" + function +
-                                               "SubsystemVendorId"]);
-                    property)
-                {
-                    asyncResp->res.jsonValue["SubsystemVendorId"] = *property;
-                }
-            };
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function + "SubsystemId"]);
+                property)
+            {
+                asyncResp->res.jsonValue["SubsystemId"] = *property;
+            }
+
+            if (std::string *property = std::get_if<std::string>(
+                    &pcieDevProperties["Function" + function +
+                                       "SubsystemVendorId"]);
+                property)
+            {
+                asyncResp->res.jsonValue["SubsystemVendorId"] = *property;
+            }
+        };
         std::string escapedPath = std::string(pciePath) + "/" + device;
         dbus::utility::escapePathForDbus(escapedPath);
         crow::connections::systemBus->async_method_call(
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index c1f41b8..f11d7e8 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -97,9 +97,7 @@
                         return;
                     }
                     // Check PowerCapEnable
-                    const bool* b =
-                        sdbusplus::message::variant_ns::get_if<bool>(
-                            &powerCapEnable);
+                    const bool* b = std::get_if<bool>(&powerCapEnable);
                     if (b == nullptr)
                     {
                         messages::internalError(asyncResp->res);
@@ -255,8 +253,7 @@
                         if (!property.first.compare("Scale"))
                         {
                             const int64_t* i =
-                                sdbusplus::message::variant_ns::get_if<int64_t>(
-                                    &property.second);
+                                std::get_if<int64_t>(&property.second);
 
                             if (i)
                             {
@@ -266,14 +263,11 @@
                         else if (!property.first.compare("PowerCap"))
                         {
                             const double* d =
-                                sdbusplus::message::variant_ns::get_if<double>(
-                                    &property.second);
+                                std::get_if<double>(&property.second);
                             const int64_t* i =
-                                sdbusplus::message::variant_ns::get_if<int64_t>(
-                                    &property.second);
+                                std::get_if<int64_t>(&property.second);
                             const uint32_t* u =
-                                sdbusplus::message::variant_ns::get_if<
-                                    uint32_t>(&property.second);
+                                std::get_if<uint32_t>(&property.second);
 
                             if (d)
                             {
@@ -290,9 +284,7 @@
                         }
                         else if (!property.first.compare("PowerCapEnable"))
                         {
-                            const bool* b =
-                                sdbusplus::message::variant_ns::get_if<bool>(
-                                    &property.second);
+                            const bool* b = std::get_if<bool>(&property.second);
 
                             if (b)
                             {
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 1fc4b4f..a4c4f5b 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -227,9 +227,8 @@
                                                 continue;
                                             }
                                             const uint32_t *value =
-                                                sdbusplus::message::variant_ns::
-                                                    get_if<uint32_t>(
-                                                        &property.second);
+                                                std::get_if<uint32_t>(
+                                                    &property.second);
                                             if (value == nullptr)
                                             {
                                                 BMCWEB_LOG_DEBUG
@@ -331,10 +330,8 @@
                                                 "ProcessorFamily")
                                             {
                                                 const std::string *value =
-                                                    sdbusplus::message::
-                                                        variant_ns::get_if<
-                                                            std::string>(
-                                                            &property.second);
+                                                    std::get_if<std::string>(
+                                                        &property.second);
                                                 if (value != nullptr)
                                                 {
                                                     nlohmann::json
@@ -467,9 +464,8 @@
                                         if (property.first == "UUID")
                                         {
                                             const std::string *value =
-                                                sdbusplus::message::variant_ns::
-                                                    get_if<std::string>(
-                                                        &property.second);
+                                                std::get_if<std::string>(
+                                                    &property.second);
 
                                             if (value != nullptr)
                                             {
