Clean up Certificate Service to use readJson

Use multiple level direct read to simplify code.

Tested: Visual only. Need help if anyone wants to test.

Change-Id: Ib7c34daefbe2bb835cbe420b40861f27442d05b1
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index a176dd5..5dc4413 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -471,13 +471,12 @@
         return;
     }
     std::string certificate;
-    nlohmann::json certificateUri;
+    std::string certURI;
     std::optional<std::string> certificateType = "PEM";
 
     if (!json_util::readJsonAction(req, asyncResp->res, "CertificateString",
-                                   certificate, "CertificateUri",
-                                   certificateUri, "CertificateType",
-                                   certificateType))
+                                   certificate, "CertificateUri/@odata.id",
+                                   certURI, "CertificateType", certificateType))
     {
         BMCWEB_LOG_ERROR("Required parameters are missing");
         return;
@@ -495,14 +494,6 @@
         return;
     }
 
-    std::string certURI;
-    if (!redfish::json_util::readJson(certificateUri, asyncResp->res,
-                                      "@odata.id", certURI))
-    {
-        messages::actionParameterMissing(asyncResp->res, "ReplaceCertificate",
-                                         "CertificateUri");
-        return;
-    }
     BMCWEB_LOG_INFO("Certificate URI to replace: {}", certURI);
 
     boost::system::result<boost::urls::url> parsedUrl =
@@ -635,7 +626,7 @@
     std::string organization;
     std::string organizationalUnit;
     std::string state;
-    nlohmann::json certificateCollection;
+    std::string certURI;
 
     // Optional parameters
     std::optional<std::vector<std::string>> optAlternativeNames =
@@ -656,13 +647,14 @@
             req, asyncResp->res, "City", city, "CommonName", commonName,
             "ContactPerson", optContactPerson, "Country", country,
             "Organization", organization, "OrganizationalUnit",
-            organizationalUnit, "State", state, "CertificateCollection",
-            certificateCollection, "AlternativeNames", optAlternativeNames,
-            "ChallengePassword", optChallengePassword, "Email", optEmail,
-            "GivenName", optGivenName, "Initials", optInitials, "KeyBitLength",
-            optKeyBitLength, "KeyCurveId", optKeyCurveId, "KeyPairAlgorithm",
-            optKeyPairAlgorithm, "KeyUsage", optKeyUsage, "Surname", optSurname,
-            "UnstructuredName", optUnstructuredName))
+            organizationalUnit, "State", state,
+            "CertificateCollection/@odata.id", certURI, "AlternativeNames",
+            optAlternativeNames, "ChallengePassword", optChallengePassword,
+            "Email", optEmail, "GivenName", optGivenName, "Initials",
+            optInitials, "KeyBitLength", optKeyBitLength, "KeyCurveId",
+            optKeyCurveId, "KeyPairAlgorithm", optKeyPairAlgorithm, "KeyUsage",
+            optKeyUsage, "Surname", optSurname, "UnstructuredName",
+            optUnstructuredName))
     {
         return;
     }
@@ -678,13 +670,6 @@
         return;
     }
 
-    std::string certURI;
-    if (!redfish::json_util::readJson(certificateCollection, asyncResp->res,
-                                      "@odata.id", certURI))
-    {
-        return;
-    }
-
     std::string objectPath;
     std::string service;
     if (certURI.starts_with(